<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8826608353769320919</id><updated>2026-10-30T17:38:44.733+05:30</updated><category term="Network Simulator 2"/><category term="NS2"/><category term="NS3"/><category term="Network Simulator 3"/><category term="Linux"/><category term="RealTimeSystems"/><category term="C"/><category term="Embedded Systems"/><category term="EmbeddedSystems"/><category term="Ubuntu"/><category term="Linux Kernel Programming"/><category term="NS2 Tutorial"/><category term="NS2 Lecture Series"/><category term="IOT"/><category term="wireless"/><category term="Fedora"/><category term="NS3 Project"/><category term="ADA"/><category term="PHP"/><category term="Internet of Things"/><category term="Robotics"/><category term="Tracegraph"/><category term="VANET"/><category term="Contiki"/><category term="Omnet"/><category term="Sensor Networks"/><category term="VHDL"/><category term="AODV"/><category term="8051"/><category term="Moodle"/><category term="MySQL"/><category term="Omnet++"/><category term="ROS"/><category term="Wired network"/><category term="AWK"/><category term="Linux Commands"/><category term="TCL"/><category term="C++"/><category term="Data Structures"/><category term="Deep Learning"/><category term="IoT Tutorials"/><category term="Javascript"/><category term="NS2 Errors"/><category term="Python"/><category term="xgraph"/><category term="Analytics"/><category term="Digital Electronics"/><category term="Mac OS"/><category term="R"/><category term="Software Engineering"/><category term="Windows 10"/><category term="nsnamcom"/><category term="Network Simulation"/><category term="PyTorch"/><category term="Research"/><category term="Windows 11"/><category term="Windows 7"/><category term="Windows 8"/><category term="Windows7"/><category term="CPS. Cyber Physical Systems"/><category term="CentOS"/><category term="Computer Networks"/><category term="Energy"/><category term="HowTos"/><category term="Linux Mint"/><category term="Presentation"/><category term="Protocol"/><category term="RTOS"/><category term="Videos"/><category term="Wireshark"/><category term="gnuplot"/><category term="ns-3 Tutorial"/><category term="routing"/><category term="5G"/><category term="ARM"/><category term="Android"/><category term="Animator"/><category term="Apache"/><category term="CMS"/><category term="CSMA"/><category term="Cloud"/><category term="Electrical Engineering"/><category term="Errors"/><category term="Flow Monitor"/><category term="FlowMonitor"/><category term="Installation"/><category term="Kali Linux"/><category term="MANETs"/><category term="NetAnim"/><category term="Network Analyser"/><category term="Network Analysis"/><category term="Node JS"/><category term="Open Source"/><category term="Optical Networks"/><category term="Perl"/><category term="Point to Point"/><category term="Research Tools"/><category term="SDN"/><category term="Shell"/><category term="Special"/><category term="Stone Letters"/><category term="Testing"/><category term="Visualizer"/><category term="Youtube"/><category term="elearning"/><category term="network simulator3"/><category term="ns-3.44"/><category term="wordpress"/><title type='text'>Engineering Clinic</title><subtitle type='html'>Its all about Network Simulations (NS2, NS3), Internet of Things, Sensor Networks, Programming, Embedded Systems, Cyber Physical Systems, etc</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.nsnam.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>528</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-2432755320182314277</id><published>2026-09-18T10:36:00.000+05:30</published><updated>2026-09-18T10:36:00.115+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulate a hybrid CSMA network with 30 nodes and analyse fairness using Flow Monitor</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulate a Hybrid CSMA Network with 30 Nodes and Analyse Fairness Using Flow Monitor&lt;/b&gt;&lt;/h1&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #007acc; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Aim:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  To simulate a hybrid CSMA network consisting of 30 nodes using the NS-3 discrete-event network simulator, and to analyze network performance and bandwidth fairness utilizing FlowMonitor, NetAnim, PCAP traces, and Gnuplot.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Objectives:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Model a hybrid CSMA network scale with 30 nodes using &lt;code&gt;CsmaHelper&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Configure multiple UDP traffic flows between the active nodes using &lt;code&gt;OnOffHelper&lt;/code&gt; and &lt;code&gt;PacketSinkHelper&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Collect flow-level performance statistics including throughput, delay, and packet loss using &lt;code&gt;FlowMonitor&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Generate packet-level trace files via ASCII tracing and visualize network topology layout with NetAnim.&lt;/li&gt;
  &lt;li&gt;Capture transmission behaviour using PCAP traces for deep inspection in Wireshark.&lt;/li&gt;
  &lt;li&gt;Evaluate channel bandwidth sharing and fairness among active flows by computing Jain&#39;s Fairness Index.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Simulation Parameters:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Simulator:&lt;/b&gt; NS-3&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Number of Nodes:&lt;/b&gt; 30 Nodes&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Channel Type:&lt;/b&gt; CSMA (Carrier Sense Multiple Access)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Data Rate:&lt;/b&gt; 100 Mbps (CSMA Channel)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Propagation Delay:&lt;/b&gt; 6,560 ns&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Traffic Type:&lt;/b&gt; UDP (OnOff Application)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Application Data Rate:&lt;/b&gt; 5 Mbps per source flow&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Packet Size:&lt;/b&gt; 1024 bytes&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Simulation Time:&lt;/b&gt; 22 seconds&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Analysis Tool:&lt;/b&gt; FlowMonitor&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Source Code:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #75715e;&quot;&gt;/*&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * Hybrid CSMA Network Simulation with 30 Nodes&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * Includes:&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * FlowMonitor (fairness analysis)&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * TraceMetrics&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * NetAnim visualization&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * PCAP for Wireshark&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * Gnuplot output support&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; */&lt;/span&gt;

&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/csma-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

NS_LOG_COMPONENT_DEFINE(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;HybridCsma30Nodes&quot;&lt;/span&gt;);

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt; *argv[])
{
    uint32_t nNodes = &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;

    CommandLine cmd;
    cmd.Parse(argc, argv);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Create nodes&lt;/span&gt;
    NodeContainer nodes;
    nodes.Create(nNodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Create CSMA helper&lt;/span&gt;
    CsmaHelper csma;
    csma.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;100Mbps&quot;&lt;/span&gt;));
    csma.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, TimeValue(NanoSeconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;6560&lt;/span&gt;)));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Install devices&lt;/span&gt;
    NetDeviceContainer devices;
    devices = csma.Install(nodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Enable PCAP tracing (Wireshark)&lt;/span&gt;
    csma.EnablePcapAll(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;hybrid-csma&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Install Internet stack&lt;/span&gt;
    InternetStackHelper stack;
    stack.Install(nodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Assign IP addresses&lt;/span&gt;
    Ipv4AddressHelper address;
    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);

    Ipv4InterfaceContainer interfaces;
    interfaces = address.Assign(devices);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Create UDP traffic sources and sinks&lt;/span&gt;
    uint16_t port = &lt;span style=&quot;color: #ae81ff;&quot;&gt;9&lt;/span&gt;;

    ApplicationContainer sinkApps;
    ApplicationContainer sourceApps;

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (uint32_t i = &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;; i &amp;lt; nNodes; i++)
    {
        &lt;span style=&quot;color: #75715e;&quot;&gt;// Install receiver&lt;/span&gt;
        PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                              InetSocketAddress(Ipv4Address::GetAny(), port + i));

        sinkApps.Add(sink.Install(nodes.Get(i)));

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Install sender&lt;/span&gt;
        OnOffHelper source(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                           InetSocketAddress(interfaces.GetAddress(i), port + i));

        source.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5Mbps&quot;&lt;/span&gt;));
        source.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;PacketSize&quot;&lt;/span&gt;, UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1024&lt;/span&gt;));

        sourceApps.Add(source.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;)));
    }

    sinkApps.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1.0&lt;/span&gt;));
    sinkApps.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;20.0&lt;/span&gt;));

    sourceApps.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2.0&lt;/span&gt;));
    sourceApps.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;20.0&lt;/span&gt;));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Enable NetAnim visualization&lt;/span&gt;
    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;hybrid-csma.xml&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (uint32_t i = &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;; i &amp;lt; nNodes; i++)
    {
        anim.SetConstantPosition(nodes.Get(i), i * &lt;span style=&quot;color: #ae81ff;&quot;&gt;5&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;10&lt;/span&gt;);
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Enable FlowMonitor&lt;/span&gt;
    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    Simulator::Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;22.0&lt;/span&gt;));
    AsciiTraceHelper ascii;
    csma.EnableAsciiAll(ascii.CreateFileStream(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;hybrid-csma.tr&quot;&lt;/span&gt;));
    Simulator::Run();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// FlowMonitor statistics&lt;/span&gt;
    monitor-&amp;gt;CheckForLostPackets();

    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowmon.GetClassifier());

    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats =
        monitor-&amp;gt;GetFlowStats();

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; totalThroughput = &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n========= FLOW MONITOR RESULTS =========\n&quot;&lt;/span&gt;;

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; iter = stats.begin(); iter != stats.end(); ++iter)
    {
        Ipv4FlowClassifier::FiveTuple t =
            classifier-&amp;gt;FindFlow(iter-&amp;gt;first);

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughput =
            iter-&amp;gt;second.rxBytes * &lt;span style=&quot;color: #ae81ff;&quot;&gt;8.0&lt;/span&gt; /
            (iter-&amp;gt;second.timeLastRxPacket.GetSeconds() -
             iter-&amp;gt;second.timeFirstTxPacket.GetSeconds()) /
            &lt;span style=&quot;color: #ae81ff;&quot;&gt;1024&lt;/span&gt; / &lt;span style=&quot;color: #ae81ff;&quot;&gt;1024&lt;/span&gt;;

        totalThroughput += throughput;

        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Flow ID: &quot;&lt;/span&gt; &amp;lt;&amp;lt; iter-&amp;gt;first &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Source: &quot;&lt;/span&gt; &amp;lt;&amp;lt; t.sourceAddress &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Destination: &quot;&lt;/span&gt; &amp;lt;&amp;lt; t.destinationAddress &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Throughput: &quot;&lt;/span&gt; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay: &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; (iter-&amp;gt;second.delaySum.GetSeconds() /
                      iter-&amp;gt;second.rxPackets)
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; s\n&quot;&lt;/span&gt;;

        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packets Lost: &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; iter-&amp;gt;second.lostPackets &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n\n&quot;&lt;/span&gt;;
    }

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Total Throughput: &quot;&lt;/span&gt;
              &amp;lt;&amp;lt; totalThroughput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;;

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Save FlowMonitor XML (for fairness + gnuplot)&lt;/span&gt;
    monitor-&amp;gt;SerializeToXmlFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;flowmon-results.xml&quot;&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;&quot;&gt;true&lt;/span&gt;);

    Simulator::Destroy();

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Output and Visualization:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Simulation Terminal Output&quot; height=&quot;443&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjexrYdYgAxLBK_cegEkn_Bv0RWUam8bYj9Br46CCO5_T2_pA_ErJahVGflHYCczy_TgWc9Gg3CTdYOvtM7IpmgkuT1a_uHDhTX_t2n5N4B1FBnpu7H-bxXoRkUFQ2ozi92dtl2MX1sXhNah_C37JjjDteeKkRZFlukAWO0ynwmKq5Rv8JkUOoREdY3--w&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;525&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 1 — Terminal Execution Output Showing FlowMonitor Flow Statistics for 30-Node Hybrid CSMA Network.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  The simulation executes successfully, allocating distinct flow identifiers across the 29 active client-server pairs. FlowMonitor captures flow metrics such as throughput, aggregated delay, and dropped packets, exporting raw metrics to an XML document for further analysis.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Performance Graphs &amp;amp; Analysis:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Network Topology Visualization&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhq2Ocp8sP4AbSIS2Gu2q5YMm-qZIXVGoRyKt9dT29e3dIPZHqNCFDTx3rv8Ctd6PCgRX4il2jbWRDezwjpwid-zsutKj6a53z-SVg5vqYcKRKIiFjYO8lZwjXYLsEd79lQcChnrIMJTdeoXZCUlfVzqS9RP-dguGWCwDifHxoyt-0D4bK2R-S1LIasIpM&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;532&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 2 — NetAnim Visualization of the 30-Node CSMA Bus Topology.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Throughput vs Flow ID Graph&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjXlMMoGwS84jtWT7OsYP9ctUTOTqseAAWZpW45HQHgtd36yW9E3zJ7wYgKSsDYD2fS4Cn4JnZRj_CBzPJ9BJWFtrphYa_KiPfhZL4Tq0kPa_Qqr-r0az3grffCi3dujDMWKyL7hDbXaCKhhcZZu3Os7TsvjzKH-2_UW6yOKyPyf6iZKkR482F64FOkNus&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;552&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 3 — Throughput vs Flow ID Distribution across nodes.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Delay vs Flow ID Graph&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjKPkzWSx9s-bqeeui-2vICqB4B0o5rsbyK7ZonenZdw8SY6mJuMNSkBXNDxy2oq4gn876DwpY6vx-G0u2ihdfOC9qPFLi9TVUuPDhxJlvubQEUG-SbvYSsc9S6lS4ssT-xkBbNwtN27NC52hkiyVPa4JDXrxK4TUIVM05SSB_gdY2psCZRwWhdlkohF3k&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;558&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 4 — End-to-End Delay vs Flow ID.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Packet Loss vs Flow ID Graph&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjjV-gR01VkHu4VYdGUe_lM5C_kG4FlN7tHXgyIehxxF60gbMliC-87CSDtCE8KJ1CydznuM5aABLdZ9UZTTsBwYL8AdKBvFt2hCjdsNRYUwWXfrR7119hqIwTPrVRHSUH1XigUSHw6XSckqp6lRRNzD-llMONLV8ayLrnaSWSKyo05-_ffLUtVLT6dCuQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;659&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 5 — Packet Loss Distribution per Flow ID.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Throughput Fairness and Jain&#39;s Index Graph&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj59Vs0Gevm3wQusCXft8HYtNAaHKlPBTsFmbQg0GuLArbCzhXp_CR5SRa0D5anjon-cLzUjoZRipjY1HF9bAOW2l1V-kruGyp9nDlvbBBW09PacZe4JiW7K07BaAyKtqD0T9jIEOQVQf3ZonXDeDcb2vafrFGYj5p_3f8HhzmtzQe3xCHZjU6brHZe_8g&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;658&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 6 — Bandwidth Fairness Analysis and Flow Share Distribution.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Wireshark PCAP Capture Analysis:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  PCAP trace files generated by the CSMA helper enable deep packet inspection via Wireshark. The captures demonstrate carrier-sense multiple access medium contention, collisions, and backoff states among the 30 nodes sharing the 100 Mbps broadcast medium.
&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark PCAP Inspection 1&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhq2Ocp8sP4AbSIS2Gu2q5YMm-qZIXVGoRyKt9dT29e3dIPZHqNCFDTx3rv8Ctd6PCgRX4il2jbWRDezwjpwid-zsutKj6a53z-SVg5vqYcKRKIiFjYO8lZwjXYLsEd79lQcChnrIMJTdeoXZCUlfVzqS9RP-dguGWCwDifHxoyt-0D4bK2R-S1LIasIpM&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;532&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 7 — Wireshark Packet Capture Window displaying UDP stream packets over CSMA interface.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark PCAP Inspection 2&quot; height=&quot;465&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjXlMMoGwS84jtWT7OsYP9ctUTOTqseAAWZpW45HQHgtd36yW9E3zJ7wYgKSsDYD2fS4Cn4JnZRj_CBzPJ9BJWFtrphYa_KiPfhZL4Tq0kPa_Qqr-r0az3grffCi3dujDMWKyL7hDbXaCKhhcZZu3Os7TsvjzKH-2_UW6yOKyPyf6iZKkR482F64FOkNus&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;552&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 8 — Detailed Packet Header Information captured from hybrid CSMA simulation trace.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Result:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The simulation successfully modeled a hybrid CSMA network with 30 nodes transmitting concurrent UDP streams. FlowMonitor statistics and Gnuplot charts successfully quantified the performance parameters (throughput, end-to-end delay, and packet loss ratio) across all flows.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Inference:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Fairness:&lt;/b&gt; CSMA networks distribute shared medium access fairly among active nodes when loads are balanced, yielding a high Jain&#39;s Fairness Index close to 1.0.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Delay &amp;amp; Loss:&lt;/b&gt; As the number of active contending nodes scales up to 30, medium contention increases, leading to higher queuing delays and occasional packet losses.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Monitoring Utility:&lt;/b&gt; FlowMonitor combined with NetAnim and Gnuplot provides an end-to-end analytical framework for evaluating multi-node topologies in NS-3.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Tools Used:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;NS-3 Discrete-Event Network Simulator (C++)&lt;/li&gt;
  &lt;li&gt;FlowMonitor Module&lt;/li&gt;
  &lt;li&gt;NetAnim (Network Animator)&lt;/li&gt;
  &lt;li&gt;Gnuplot for graph generation&lt;/li&gt;
  &lt;li&gt;Wireshark / PCAP Traces&lt;/li&gt;
&lt;/ul&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/2432755320182314277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/simulate-hybrid-csma-network-with-30.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/2432755320182314277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/2432755320182314277'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/simulate-hybrid-csma-network-with-30.html' title='Simulate a hybrid CSMA network with 30 nodes and analyse fairness using Flow Monitor'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjexrYdYgAxLBK_cegEkn_Bv0RWUam8bYj9Br46CCO5_T2_pA_ErJahVGflHYCczy_TgWc9Gg3CTdYOvtM7IpmgkuT1a_uHDhTX_t2n5N4B1FBnpu7H-bxXoRkUFQ2ozi92dtl2MX1sXhNah_C37JjjDteeKkRZFlukAWO0ynwmKq5Rv8JkUOoREdY3--w=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-5550307695704486791</id><published>2026-09-17T10:01:00.000+05:30</published><updated>2026-09-17T10:01:00.267+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Study the Impact of Initial Congestion Window on TCP Startup Throughput</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Study the Impact of Initial Congestion Window on TCP Startup Throughput&lt;/b&gt;&lt;/h1&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #007acc; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Aim:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  To study the impact of the initial congestion window (IW) on TCP startup throughput using NS-3 simulation.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Objectives:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;To analyze TCP performance during the slow start phase.&lt;/li&gt;
  &lt;li&gt;To compare throughput for different values of initial congestion window (IW).&lt;/li&gt;
  &lt;li&gt;To observe how quickly TCP reaches optimal bandwidth utilization for different IW values.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Simulation Parameters:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Simulator:&lt;/b&gt; NS-3&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;TCP Variant:&lt;/b&gt; TCP NewReno (default)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Simulation Time:&lt;/b&gt; 3 seconds&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Topology:&lt;/b&gt; Point-to-Point (2 nodes)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Bandwidth:&lt;/b&gt; 1 Mbps&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Delay:&lt;/b&gt; 100 ms&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Packet Size:&lt;/b&gt; Default&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Application:&lt;/b&gt; BulkSend Application&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;IW Values Tested:&lt;/b&gt; 1, 2, 4, 10 segments&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Source Code:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt; ()
{
    std::vector&amp;lt;uint32_t&amp;gt; cwndValues = {&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;4&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;10&lt;/span&gt;};

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Create data file&lt;/span&gt;
    std::ofstream outfile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;cwnd.data&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (uint32_t cwnd : cwndValues)
    {
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n===== Running for IW = &quot;&lt;/span&gt; &amp;lt;&amp;lt; cwnd &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; =====\n&quot;&lt;/span&gt;;

        Config::SetDefault (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::InitialCwnd&quot;&lt;/span&gt;, UintegerValue (cwnd));

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Nodes&lt;/span&gt;
        NodeContainer nodes;
        nodes.Create (&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;);

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Link (slow to highlight effect)&lt;/span&gt;
        PointToPointHelper p2p;
        p2p.SetDeviceAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;1Mbps&quot;&lt;/span&gt;));
        p2p.SetChannelAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;100ms&quot;&lt;/span&gt;));

        NetDeviceContainer devices = p2p.Install (nodes);

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Internet stack&lt;/span&gt;
        InternetStackHelper stack;
        stack.Install (nodes);

        &lt;span style=&quot;color: #75715e;&quot;&gt;// IP assignment&lt;/span&gt;
        Ipv4AddressHelper address;
        address.SetBase (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
        Ipv4InterfaceContainer interfaces = address.Assign (devices);

        uint16_t port = &lt;span style=&quot;color: #ae81ff;&quot;&gt;8080&lt;/span&gt;;

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Receiver&lt;/span&gt;
        PacketSinkHelper sink (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
            InetSocketAddress (Ipv4Address::GetAny (), port));
        ApplicationContainer sinkApp = sink.Install (nodes.Get (&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;));
        sinkApp.Start (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;));
        sinkApp.Stop (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;3.0&lt;/span&gt;));

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Sender&lt;/span&gt;
        BulkSendHelper source (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
            InetSocketAddress (interfaces.GetAddress (&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), port));
        source.SetAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxBytes&quot;&lt;/span&gt;, UintegerValue (&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));

        ApplicationContainer sourceApp = source.Install (nodes.Get (&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));
        sourceApp.Start (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;));
        sourceApp.Stop (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;3.0&lt;/span&gt;));

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Flow Monitor&lt;/span&gt;
        FlowMonitorHelper flowmon;
        Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

        Simulator::Stop (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;3.0&lt;/span&gt;));
        Simulator::Run ();

        monitor-&amp;gt;CheckForLostPackets();
        std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats();

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughput = &lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;;

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; &amp;amp;flow : stats)
        {
            &lt;span style=&quot;color: #75715e;&quot;&gt;// Ignore small ACK/control flows&lt;/span&gt;
            &lt;span style=&quot;color: #66d9ef;&quot;&gt;if&lt;/span&gt; (flow.second.rxBytes &amp;lt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;50000&lt;/span&gt;) &lt;span style=&quot;color: #66d9ef;&quot;&gt;continue&lt;/span&gt;;

            throughput = flow.second.rxBytes * &lt;span style=&quot;color: #ae81ff;&quot;&gt;8.0&lt;/span&gt; / (&lt;span style=&quot;color: #ae81ff;&quot;&gt;3.0&lt;/span&gt; * &lt;span style=&quot;color: #ae81ff;&quot;&gt;1000000.0&lt;/span&gt;);
        }

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Print output&lt;/span&gt;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;IW = &quot;&lt;/span&gt; &amp;lt;&amp;lt; cwnd
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; → Throughput = &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;;

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Save to file&lt;/span&gt;
        outfile &amp;lt;&amp;lt; cwnd &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; std::endl;

        Simulator::Destroy ();
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Close file&lt;/span&gt;
    outfile.close();
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Output:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Simulation Terminal Output&quot; height=&quot;187&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg19BP7WfrNRp7Kb3VUIl5nLdrk29XnT331XogrIlZeBL98PVs3ncfkQx42vpcQ4Etx3jb3gXx_k_suwlCxR0Hp3OUBb5gqxLL9mRO4-5xsdGp4WKrtIoW4uEsfWPAaUzdQEsOKuZ9jBRGQckEte5Lq3gNPThEzbvRXPfB1i9UdqOUMAwZ1yn6kFgzEpYs&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;324&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Graph:&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Throughput vs Initial Congestion Window Graph&quot; height=&quot;331&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiNyhSnoZJT7EBqz-cQZfaVUEQ5M_09ycI0IzdLyblbErYYrO4YEr3O69ndNCDUW0V0KABVPUoOed3Io8IAg4SEfwu4B5oF4Sb12Ge6OAVw4LTnt8HZMvKn5NhBhbkL4wA6J-c291cPr2FHjfRxZ-0K_KkAxfFTJYUgTljP2JXAcuVxhBSspBcbxRliJro&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;592&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Result&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The simulation results show that the throughput increases with the increase in the initial congestion window (IW). For lower IW values, the TCP connection experiences a slower startup, resulting in lower throughput. As the IW increases, more packets are transmitted in the initial phase, which improves the throughput significantly.
&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  However, the increase in throughput becomes gradual at higher IW values, indicating that the network bandwidth is being approached. The results demonstrate that a larger IW improves TCP startup performance, but excessive values may lead to congestion in real network conditions.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Key Observations&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;The throughput of the TCP connection increases as the initial congestion window (IW) increases.&lt;/li&gt;
  &lt;li&gt;For small IW values (e.g., IW = 1), the TCP connection starts slowly, resulting in lower initial throughput.&lt;/li&gt;
  &lt;li&gt;As IW increases (e.g., IW = 2 and IW = 4), the startup phase becomes faster, leading to moderate improvement in throughput.&lt;/li&gt;
  &lt;li&gt;For larger IW values (e.g., IW = 10), the sender is able to transmit more data in the initial phase, resulting in higher throughput.&lt;/li&gt;
  &lt;li&gt;The rate of increase in throughput gradually reduces at higher IW values, indicating that the network is approaching its bandwidth limit.&lt;/li&gt;
  &lt;li&gt;Very large IW values may lead to congestion and potential packet loss, especially in networks with limited bandwidth and higher delay.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Implications from Graph&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;The graph shows a clear increase in throughput as the initial congestion window (IW) increases, indicating that TCP startup performance improves with higher IW values.&lt;/li&gt;
  &lt;li&gt;At lower IW values, the curve rises slowly, which reflects the slow start behavior of TCP where data transmission begins conservatively.&lt;/li&gt;
  &lt;li&gt;As IW increases, the curve becomes steeper, showing that more data is transmitted in the initial phase, leading to faster bandwidth utilization.&lt;/li&gt;
  &lt;li&gt;At higher IW values, the graph begins to flatten, indicating that the throughput is approaching the maximum available network bandwidth.&lt;/li&gt;
  &lt;li&gt;The diminishing slope at higher IW values suggests that increasing IW beyond a certain point yields only marginal improvement in throughput.&lt;/li&gt;
  &lt;li&gt;The graph highlights a trade-off between performance and stability, where higher IW improves speed but may increase the risk of congestion in real network scenarios.&lt;/li&gt;
  &lt;li&gt;Overall, the graph implies that selecting an optimal IW value is crucial to achieving a balance between fast startup and controlled congestion.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;b&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;The initial congestion window (IW) has a significant impact on TCP startup performance and overall throughput.&lt;/li&gt;
  &lt;li&gt;Increasing the IW allows the sender to transmit more data at the beginning of the connection, thereby improving throughput and reducing startup delay.&lt;/li&gt;
  &lt;li&gt;However, excessively large IW values can lead to network congestion, packet loss, and reduced efficiency.&lt;/li&gt;
  &lt;li&gt;Therefore, an optimal IW value provides a balance between fast startup and controlled congestion.&lt;/li&gt;
  &lt;li&gt;In this experiment, higher IW values resulted in improved throughput, confirming that tuning IW is an important factor in optimizing TCP performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/5550307695704486791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/study-impact-of-initial-congestion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5550307695704486791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5550307695704486791'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/study-impact-of-initial-congestion.html' title='Study the Impact of Initial Congestion Window on TCP Startup Throughput'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEg19BP7WfrNRp7Kb3VUIl5nLdrk29XnT331XogrIlZeBL98PVs3ncfkQx42vpcQ4Etx3jb3gXx_k_suwlCxR0Hp3OUBb5gqxLL9mRO4-5xsdGp4WKrtIoW4uEsfWPAaUzdQEsOKuZ9jBRGQckEte5Lq3gNPThEzbvRXPfB1i9UdqOUMAwZ1yn6kFgzEpYs=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-9202294841579957140</id><published>2026-09-16T09:58:52.526+05:30</published><updated>2026-09-16T09:58:52.561+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="network simulator3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Performance Evaluation of TCP NewReno and TCP Cubic under Varying Round Trip Times Using NS-3</title><content type='html'>&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
&lt;meta charset=&quot;UTF-8&quot;&gt;&lt;/meta&gt;
&lt;meta content=&quot;width=device-width, initial-scale=1.0&quot; name=&quot;viewport&quot;&gt;&lt;/meta&gt;
&lt;style&gt;
.post-content { font-family: Arial, sans-serif; line-height: 1.7; color: #222; }
.post-content h2 { font-size: 1.45rem; margin: 28px 0 12px; border-bottom: 2px solid #eee; padding-bottom: 6px; }
.post-content p { margin: 0 0 14px; }
.post-content ul { margin: 8px 0 18px 24px; padding-left: 18px; }
.post-content li { margin: 7px 0; }
.post-content table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.post-content td, .post-content th { border: 1px solid #ccc; padding: 10px; vertical-align: top; }
.post-content td:first-child { font-weight: 700; }
.post-content .source-code { background: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto; }
.post-content .source-code code { color: inherit; background: transparent; font: inherit; }
.post-content img { max-width: 100%; height: auto; display: block; margin: 18px auto; }
.post-content .adsbygoogle { margin: 20px auto; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class=&quot;post-content&quot;&gt;

&lt;h2&gt;AIM&lt;/h2&gt;
&lt;p&gt;To analyze &lt;b&gt;Packet Loss Ratio (PLR)&lt;/b&gt; and &lt;b&gt;Packet Delivery Ratio (PDR)&lt;/b&gt; in a congested point-to-point router network with mixed TCP and UDP traffic using NS-3 simulation.&lt;/p&gt;

&lt;h2&gt;1. Introduction to Network Congestion&lt;/h2&gt;
&lt;p&gt;Network congestion is a fundamental challenge in packet-switched computer networks. It manifests when the aggregate demand for bandwidth exceeds the physical capacity of network resources, such as intermediary routers or transmission links. When traffic volume outpaces a router&#39;s processing speed or link bandwidth, the router&#39;s buffer (queue) begins to fill. Once this queue reaches maximum capacity, subsequent incoming packets are discarded—a process known as tail-dropping. These dropped packets result in severe queuing delays, wasted bandwidth, and degraded application-level performance.&lt;/p&gt;

&lt;h2&gt;2. Performance Metrics&lt;/h2&gt;
&lt;p&gt;To empirically evaluate network reliability and the severity of congestion during simulation, two primary performance metrics are analyzed:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Packet Delivery Ratio (PDR):&lt;/b&gt; This metric represents the percentage of data packets successfully received at the destination relative to the total number transmitted by the source. A higher PDR signifies a robust and reliable network connection.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Packet Loss Ratio (PLR):&lt;/b&gt; Conversely, the PLR quantifies network failure by measuring the percentage of packets discarded in transit due to buffer overflow or link errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;3. Protocol Behavior Under Congestion: TCP vs. UDP&lt;/h2&gt;
&lt;p&gt;The impact of a congested link varies significantly depending on the transport layer protocol utilized by the active flows.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Transmission Control Protocol (TCP):&lt;/b&gt; As a connection-oriented protocol, TCP is designed for high reliability. It features an integrated, closed-loop congestion control mechanism. When TCP detects packet loss (an indicator of congestion), it employs algorithms such as slow start and Additive Increase Multiplicative Decrease (AIMD) to dynamically scale back its transmission window. By actively reducing its sending rate, TCP helps alleviate network strain, ultimately maintaining a high PDR, albeit at the cost of immediate throughput.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;User Datagram Protocol (UDP):&lt;/b&gt; UDP is a connectionless protocol that lacks inherent congestion control or backoff mechanisms. It transmits datagrams continuously at the application&#39;s defined rate, completely blind to underlying network conditions. During a bottleneck event, TCP flows will politely reduce their traffic, while UDP flows will continue to flood the router. Because the router utilizes a strict tail-drop mechanism when its queue is full, the aggressive, unyielding nature of UDP results in a dramatically higher Packet Loss Ratio compared to TCP.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;4. Simulation Scenario and Network Topology&lt;/h2&gt;
&lt;p&gt;To observe the interaction between competing protocols under stress, this experiment implements a classic &quot;Dumbbell&quot; network topology. This specific architecture is designed to force multiple high-capacity data streams through a single, constrained pathway.&lt;/p&gt;
&lt;p&gt;The physical layout consists of six independent sender nodes—three operating TCP flows and three operating UDP flows. All six senders transmit data across high-speed access links to a central gateway router (R1). Traffic is then forwarded from R1 to a second central router (R2) across a heavily restricted bottleneck link. Finally, R2 distributes the packets to their respective receiver nodes. Because the aggregate data rate of the six senders vastly exceeds the bandwidth of the R1-R2 link, the router queue quickly fills, guaranteeing a congestion event.&lt;/p&gt;

&lt;h2&gt;5. Simulation Parameters&lt;/h2&gt;
&lt;p&gt;The experiment is modeled using the NS-3 discrete-event network simulator, with network traffic data captured and analyzed via the FlowMonitor module. The specific environmental constraints and protocol parameters are detailed in the table below:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Parameter&lt;/th&gt;
      &lt;th&gt;Assigned Value&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Simulator Environment&lt;/td&gt;
      &lt;td&gt;NS-3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Active Network Flows&lt;/td&gt;
      &lt;td&gt;3 TCP (NewReno) &amp;amp; 3 UDP&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Access Link Properties&lt;/td&gt;
      &lt;td&gt;10 Mbps Bandwidth, 2 ms Delay&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Bottleneck Link Properties&lt;/td&gt;
      &lt;td&gt;1 Mbps Bandwidth, 10 ms Delay&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Router Queue Size&lt;/td&gt;
      &lt;td&gt;10 Packets (Tail-Drop Mechanism)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;UDP Transmission Rate&lt;/td&gt;
      &lt;td&gt;2000 packets/sec&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Total Simulation Time&lt;/td&gt;
      &lt;td&gt;20 seconds&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Monitoring Tool&lt;/td&gt;
      &lt;td&gt;FlowMonitor&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;SOURCE CODE&lt;/h2&gt;
&lt;pre class=&quot;source-code&quot;&gt;&lt;code&gt;/*
 * NS-3 Simulation: Packet Loss Ratio and PDR in a Congested
 * Point-to-Point Router with Mixed TCP + UDP Traffic
 *
 * Register Number: [Your ID Redacted]
 * Topic: Analyze packet loss ratio and PDR in a congested
 *        point-to-point router with mixed TCP+UDP traffic.
 *
 * Prompt used (Claude Sonnet 4):
 * &quot;Write a complete NS-3 simulation in C++ that:
 *  1. Creates a dumbbell topology: 3 TCP senders and 3 UDP senders
 *     connected to a bottleneck router R1, which connects to R2,
 *     which connects to 3 TCP receivers and 3 UDP receivers.
 *  2. Sets a small queue size on the R1-R2 bottleneck link (10 packets)
 *     to simulate congestion.
 *  3. Uses OnOffApplication for TCP (BulkSendApplication) and
 *     UdpClientServer for UDP.
 *  4. Runs for 20 seconds and outputs:
 *     - Flow monitor XML for PDR and packet loss analysis
 *     - Ascii trace for animation with PyViz or custom Python script
 *  5. Prints per-flow stats: TX packets, RX packets, lost packets,
 *     PDR (%), and PLR (%) to stdout.&quot;
 *
 * Compile &amp;amp; Run:
 *   ./ns3 run scratch/24bps1xxx.cc
 */

#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/ipv4-global-routing-helper.h&quot;
#include &quot;ns3/netanim-module.h&quot;
#include &amp;lt;iomanip&amp;gt;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;MixedTrafficCongestion&quot;);

int main(int argc, char *argv[])
{
    // ─── Simulation parameters ─────────────────────────────────────────────
    uint32_t nTCP        = 3;        // Number of TCP sender/receiver pairs
    uint32_t nUDP        = 3;        // Number of UDP sender/receiver pairs
    double   simTime     = 20.0;     // Simulation duration (seconds)
    uint32_t queueSize   = 10;       // Bottleneck queue size (packets) — causes congestion
    std::string bottleneckBW  = &quot;1Mbps&quot;;
    std::string bottleneckDel = &quot;10ms&quot;;
    std::string accessBW      = &quot;10Mbps&quot;;
    std::string accessDel     = &quot;2ms&quot;;

    CommandLine cmd;
    cmd.AddValue(&quot;nTCP&quot;,      &quot;Number of TCP flows&quot;,          nTCP);
    cmd.AddValue(&quot;nUDP&quot;,      &quot;Number of UDP flows&quot;,          nUDP);
    cmd.AddValue(&quot;simTime&quot;,   &quot;Simulation duration (s)&quot;,      simTime);
    cmd.AddValue(&quot;queueSize&quot;, &quot;Bottleneck queue depth (pkts)&quot;, queueSize);
    cmd.Parse(argc, argv);

    // ─── Topology ──────────────────────────────────────────────────────────
    //
    //  TCP_S[0..2]  ──┐                    ┌── TCP_R[0..2]
    //                 ├── R1 ──(bottleneck)── R2 ──┤
    //  UDP_S[0..2]  ──┘                    └── UDP_R[0..2]
    //

    NodeContainer tcpSenders, udpSenders;
    NodeContainer tcpReceivers, udpReceivers;
    NodeContainer routers;

    tcpSenders.Create(nTCP);
    udpSenders.Create(nUDP);
    tcpReceivers.Create(nTCP);
    udpReceivers.Create(nUDP);
    routers.Create(2);   // R1, R2

    Ptr&amp;lt;Node&amp;gt; R1 = routers.Get(0);
    Ptr&amp;lt;Node&amp;gt; R2 = routers.Get(1);

    // ─── P2P Helpers ───────────────────────────────────────────────────────
    PointToPointHelper accessLink, bottleneckLink;

    accessLink.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(accessBW));
    accessLink.SetChannelAttribute(&quot;Delay&quot;,   StringValue(accessDel));

    bottleneckLink.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(bottleneckBW));
    bottleneckLink.SetChannelAttribute(&quot;Delay&quot;,   StringValue(bottleneckDel));
    bottleneckLink.SetQueue(&quot;ns3::DropTailQueue&quot;,
                            &quot;MaxSize&quot;, StringValue(std::to_string(queueSize) + &quot;p&quot;));

    // ─── Install Internet Stack ────────────────────────────────────────────
    InternetStackHelper internet;
    internet.Install(tcpSenders);
    internet.Install(udpSenders);
    internet.Install(tcpReceivers);
    internet.Install(udpReceivers);
    internet.Install(routers);

    // ─── Assign IP addresses ───────────────────────────────────────────────
    Ipv4AddressHelper ipv4;
    std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; tcpSenderIfaces(nTCP), udpSenderIfaces(nUDP);
    std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; tcpRecvIfaces(nTCP),   udpRecvIfaces(nUDP);

    // TCP senders → R1
    for (uint32_t i = 0; i &amp;lt; nTCP; i++) {
        ipv4.SetBase((&quot;10.1.&quot; + std::to_string(i + 1) + &quot;.0&quot;).c_str(), &quot;255.255.255.0&quot;);
        NetDeviceContainer d = accessLink.Install(tcpSenders.Get(i), R1);
        tcpSenderIfaces[i]   = ipv4.Assign(d);
    }

    // UDP senders → R1
    for (uint32_t i = 0; i &amp;lt; nUDP; i++) {
        ipv4.SetBase((&quot;10.2.&quot; + std::to_string(i + 1) + &quot;.0&quot;).c_str(), &quot;255.255.255.0&quot;);
        NetDeviceContainer d = accessLink.Install(udpSenders.Get(i), R1);
        udpSenderIfaces[i]   = ipv4.Assign(d);
    }

    // R1 ↔ R2 bottleneck
    ipv4.SetBase(&quot;10.3.1.0&quot;, &quot;255.255.255.0&quot;);
    NetDeviceContainer bottleneckDevs = bottleneckLink.Install(R1, R2);
    Ipv4InterfaceContainer bottleneckIfaces = ipv4.Assign(bottleneckDevs);

    // R2 → TCP receivers
    for (uint32_t i = 0; i &amp;lt; nTCP; i++) {
        ipv4.SetBase((&quot;10.4.&quot; + std::to_string(i + 1) + &quot;.0&quot;).c_str(), &quot;255.255.255.0&quot;);
        NetDeviceContainer d = accessLink.Install(R2, tcpReceivers.Get(i));
        tcpRecvIfaces[i]     = ipv4.Assign(d);
    }

    // R2 → UDP receivers
    for (uint32_t i = 0; i &amp;lt; nUDP; i++) {
        ipv4.SetBase((&quot;10.5.&quot; + std::to_string(i + 1) + &quot;.0&quot;).c_str(), &quot;255.255.255.0&quot;);
        NetDeviceContainer d = accessLink.Install(R2, udpReceivers.Get(i));
        udpRecvIfaces[i]     = ipv4.Assign(d);
    }

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    // ─── Applications ──────────────────────────────────────────────────────
    uint16_t tcpPort = 9000;
    uint16_t udpPort = 8000;

    // TCP: BulkSend (sender) + PacketSink (receiver)
    for (uint32_t i = 0; i &amp;lt; nTCP; i++) {
        PacketSinkHelper sinkHelper(&quot;ns3::TcpSocketFactory&quot;,
            InetSocketAddress(Ipv4Address::GetAny(), tcpPort + i));
        ApplicationContainer sinkApp = sinkHelper.Install(tcpReceivers.Get(i));
        sinkApp.Start(Seconds(0.5));
        sinkApp.Stop(Seconds(simTime));

        BulkSendHelper bulkHelper(&quot;ns3::TcpSocketFactory&quot;,
            InetSocketAddress(tcpRecvIfaces[i].GetAddress(1), tcpPort + i));
        bulkHelper.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(0)); // unlimited
        ApplicationContainer sendApp = bulkHelper.Install(tcpSenders.Get(i));
        sendApp.Start(Seconds(1.0));
        sendApp.Stop(Seconds(simTime));
    }

    // UDP: UdpClient (sender) + UdpServer (receiver)
    for (uint32_t i = 0; i &amp;lt; nUDP; i++) {
        UdpServerHelper udpServer(udpPort + i);
        ApplicationContainer serverApp = udpServer.Install(udpReceivers.Get(i));
        serverApp.Start(Seconds(0.5));
        serverApp.Stop(Seconds(simTime));

        UdpClientHelper udpClient(udpRecvIfaces[i].GetAddress(1), udpPort + i);
        udpClient.SetAttribute(&quot;MaxPackets&quot;,  UintegerValue(1000000));
        udpClient.SetAttribute(&quot;Interval&quot;,    TimeValue(MicroSeconds(500)));  // 2000 pkt/s
        udpClient.SetAttribute(&quot;PacketSize&quot;,  UintegerValue(1024));
        ApplicationContainer clientApp = udpClient.Install(udpSenders.Get(i));
        clientApp.Start(Seconds(1.0));
        clientApp.Stop(Seconds(simTime));
    }

    AsciiTraceHelper ascii;
    bottleneckLink.EnableAsciiAll(ascii.CreateFileStream(&quot;24bps1xxx-bottleneck.tr&quot;));
    bottleneckLink.EnablePcapAll(&quot;24bps1xxx-bottleneck&quot;);

    AnimationInterface anim(&quot;24bps1xxx-anim.xml&quot;);

    for (uint32_t i = 0; i &amp;lt; nTCP; i++)
        anim.SetConstantPosition(tcpSenders.Get(i), 0, (double)i * 3);
    for (uint32_t i = 0; i &amp;lt; nUDP; i++)
        anim.SetConstantPosition(udpSenders.Get(i), 0, (double)(nTCP + i) * 3);
    anim.SetConstantPosition(R1, 10, (double)(nTCP + nUDP - 1) * 1.5);
    anim.SetConstantPosition(R2, 20, (double)(nTCP + nUDP - 1) * 1.5);
    for (uint32_t i = 0; i &amp;lt; nTCP; i++)
        anim.SetConstantPosition(tcpReceivers.Get(i), 30, (double)i * 3);
    for (uint32_t i = 0; i &amp;lt; nUDP; i++)
        anim.SetConstantPosition(udpReceivers.Get(i), 30, (double)(nTCP + i) * 3);

    FlowMonitorHelper flowMonHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt; flowMon = flowMonHelper.InstallAll();

    Simulator::Stop(Seconds(simTime));
    Simulator::Run();

    flowMon-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowMonHelper.GetClassifier());

    FlowMonitor::FlowStatsContainer stats = flowMon-&amp;gt;GetFlowStats();

    std::cout &amp;lt;&amp;lt; &quot;\n=======================================================\n&quot;;
    std::cout &amp;lt;&amp;lt; &quot;  Mixed TCP+UDP Congestion Simulation — Flow Statistics\n&quot;;
    std::cout &amp;lt;&amp;lt; &quot;  Bottleneck: &quot; &amp;lt;&amp;lt; bottleneckBW &amp;lt;&amp;lt; &quot;, Queue: &quot;
              &amp;lt;&amp;lt; queueSize &amp;lt;&amp;lt; &quot; pkts\n&quot;;
    std::cout &amp;lt;&amp;lt; &quot;=======================================================\n&quot;;
    std::cout &amp;lt;&amp;lt; std::left
              &amp;lt;&amp;lt; std::setw(8)  &amp;lt;&amp;lt; &quot;FlowID&quot;
              &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; &quot;Proto&quot;
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; &quot;TX Pkts&quot;
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; &quot;RX Pkts&quot;
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; &quot;Lost Pkts&quot;
              &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; &quot;PDR (%)&quot;
              &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; &quot;PLR (%)&quot;
              &amp;lt;&amp;lt; &quot;\n&quot;;
    std::cout &amp;lt;&amp;lt; std::string(74, &#39;-&#39;) &amp;lt;&amp;lt; &quot;\n&quot;;

    uint64_t totalTx = 0, totalRx = 0, totalLost = 0;
    for (auto &amp;amp;kv : stats) {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(kv.first);
        std::string proto = (t.protocol == 6) ? &quot;TCP&quot; : &quot;UDP&quot;;

        uint64_t tx   = kv.second.txPackets;
        uint64_t rx   = kv.second.rxPackets;
        uint64_t lost = kv.second.lostPackets;
        double   pdr  = (tx &amp;gt; 0) ? (100.0 * rx / tx)   : 0.0;
        double   plr  = (tx &amp;gt; 0) ? (100.0 * lost / tx) : 0.0;

        std::cout &amp;lt;&amp;lt; std::left
                  &amp;lt;&amp;lt; std::setw(8)  &amp;lt;&amp;lt; kv.first
                  &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; proto
                  &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; tx
                  &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; rx
                  &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; lost
                  &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(2)
                  &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; pdr
                  &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; plr
                  &amp;lt;&amp;lt; &quot;\n&quot;;
        totalTx   += tx;
        totalRx   += rx;
        totalLost += lost;
    }

    double overallPDR = (totalTx &amp;gt; 0) ? (100.0 * totalRx / totalTx) : 0.0;
    double overallPLR = (totalTx &amp;gt; 0) ? (100.0 * totalLost / totalTx) : 0.0;
    std::cout &amp;lt;&amp;lt; std::string(74, &#39;-&#39;) &amp;lt;&amp;lt; &quot;\n&quot;;
    std::cout &amp;lt;&amp;lt; std::left
              &amp;lt;&amp;lt; std::setw(8)  &amp;lt;&amp;lt; &quot;TOTAL&quot;
              &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; &quot;ALL&quot;
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; totalTx
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; totalRx
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; totalLost
              &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(2)
              &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; overallPDR
              &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; overallPLR
              &amp;lt;&amp;lt; &quot;\n&quot;;
    std::cout &amp;lt;&amp;lt; &quot;=======================================================\n\n&quot;;

    flowMon-&amp;gt;SerializeToXmlFile(&quot;24bps1xxx-flowmon.xml&quot;, true, true);
    std::cout &amp;lt;&amp;lt; &quot;Flow monitor data saved to: 24bps1xxx-flowmon.xml\n&quot;;
    std::cout &amp;lt;&amp;lt; &quot;Animation XML saved to:     24bps1xxx-anim.xml\n\n&quot;;

    Simulator::Destroy();
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;Execution Command:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;./ns3 run scratch/24bps1089.cc&lt;/code&gt;&lt;/p&gt;
&lt;img alt=&quot;Execution terminal output&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhh4F_7IvDtM-mOzt1huGEVQOl6dxFEIVk_AUZQbDyd2bCQEEWwkKraYAV3aIf3KbHGR6PNB4sx2YIcSptyN-zKH_gok-cyw3cVff6u1a0SfY8T6IoR9oam9DfLYziV0T4WnBmdD-CPo9mJCxIYfC-pKkokRyae2N-B2JMPZvm-tFtBwKYRnMhoO0fELEo&quot; width=&quot;602&quot; /&gt;
&lt;p&gt;&lt;b&gt;Description:&lt;/b&gt; The animation shows packet flow from multiple senders to receivers through routers R1 and R2. The bottleneck link becomes congested, leading to packet drops at the router queue.&lt;/p&gt;

&lt;h2&gt;GRAPH (PDR / PLR / Throughput)&lt;/h2&gt;
&lt;img alt=&quot;PDR PLR Throughput Graph&quot; height=&quot;451&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg5Ppdvqu4wA4D0IEGB4IWWwYWNokiGqI-LY-cebY8luijHwUeSZqVMiUXLgfMU2C_70yFummxYDDVJHhf8q5Ne-zri-YcgDIzwUXZCcxty836xSbiJ0FLMy1P4BRWRJrR5TpLaq_77_dmqxcWJJcqMWCKkmuVOeT_Zm1mbQpfv8p1-86SZ2oWc5qgvlQs&quot; width=&quot;602&quot; /&gt;
&lt;b&gt;Description:&lt;/b&gt;
&lt;ul&gt;
  &lt;li&gt;TCP flows show high PDR (~96–98%) due to congestion control&lt;/li&gt;
  &lt;li&gt;UDP flows show low PDR (~50–60%) due to continuous transmission&lt;/li&gt;
  &lt;li&gt;Packet loss is significantly higher for UDP traffic&lt;/li&gt;
  &lt;li&gt;Increasing queue size improves PDR&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;WIRESHARK ANALYSIS&lt;/h2&gt;
&lt;img alt=&quot;Wireshark Capture 1&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhMJ7LKm_anQrOcWjrCOFuKyuQpb6OJND0wS23v0vhOqcMqWx9XG4sJPn0kO45tkcy995FrKrPG15WnSq5HGPMLZQjdrUpAFiDkcasv8SA0EUTYzQhqv_VtAvtKkuG8CCgjDKcecCe3qmNIMLX4LRomS5bIOQRz6flLxFxjUpEjKctnXrHzaITMvDvgAy4&quot; width=&quot;602&quot; /&gt;
&lt;img alt=&quot;Wireshark Capture 2&quot; height=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgO_OSbuZDcS3hm_9bmWZ60Vh82qtBjEmpUDed4sw4Y3ngAEsGgf3MojoSHu_-ph9NVsUKfSmc67q9UROxTMut-YRUqL0UstjXyc_wo3BQ7da8C-2cr1SLJg9aHWw6QhNVWHSBu3qxOG_kskCSV3RHTbr1WQvtoFTC-4qROij9gKK8fWfWf_wqrTe9GT7A&quot; width=&quot;602&quot; /&gt;
&lt;p&gt;Wireshark was used to inspect packet-level transmission using PCAP files generated by NS-3.&lt;/p&gt;

&lt;h2&gt;RESULT&lt;/h2&gt;
&lt;p&gt;The simulation successfully demonstrated congestion effects in a mixed TCP and UDP network.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;TCP achieved high reliability with minimal packet loss&lt;/li&gt;
  &lt;li&gt;UDP suffered significant packet loss due to lack of congestion control&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;INFERENCE&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;TCP is adaptive and reliable under congestion&lt;/li&gt;
  &lt;li&gt;UDP is fast but unreliable in congested networks&lt;/li&gt;
  &lt;li&gt;Queue size plays a critical role in network performance&lt;/li&gt;
  &lt;li&gt;Mixed traffic environments require traffic shaping or QoS mechanisms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;TOOLS USED&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;NS-3 Simulator&lt;/li&gt;
  &lt;li&gt;FlowMonitor&lt;/li&gt;
  &lt;li&gt;NetAnim / Python Visualization&lt;/li&gt;
  &lt;li&gt;Gnuplot / Matplotlib&lt;/li&gt;
  &lt;li&gt;Wireshark (Optional)&lt;/li&gt;
&lt;/ul&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/9202294841579957140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/performance-evaluation-of-tcp-newreno.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/9202294841579957140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/9202294841579957140'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/performance-evaluation-of-tcp-newreno.html' title='Performance Evaluation of TCP NewReno and TCP Cubic under Varying Round Trip Times Using NS-3'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhh4F_7IvDtM-mOzt1huGEVQOl6dxFEIVk_AUZQbDyd2bCQEEWwkKraYAV3aIf3KbHGR6PNB4sx2YIcSptyN-zKH_gok-cyw3cVff6u1a0SfY8T6IoR9oam9DfLYziV0T4WnBmdD-CPo9mJCxIYfC-pKkokRyae2N-B2JMPZvm-tFtBwKYRnMhoO0fELEo=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-4144382455608399703</id><published>2026-09-14T12:06:00.000+05:30</published><updated>2026-09-14T12:06:00.117+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulation of TCP NewReno vs. TCP Cubic with Varying Round Trip Time (RTT) and Throughput Analysis using NS-3</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulation of TCP NewReno vs. TCP Cubic with Varying Round Trip Time (RTT) and Throughput Analysis using NS-3&lt;/b&gt;&lt;/h1&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;2. ONE-PAGE WRITE-UP&lt;/b&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;b&gt;2.1 Introduction&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The Transmission Control Protocol (TCP) is the backbone of reliable communication over the Internet. It uses congestion control algorithms to manage traffic and prevent network collapse. This experiment compares two widely-used TCP algorithms — NewReno and Cubic — under three different Round Trip Time (RTT) conditions using the NS-3 network simulator, measuring throughput, convergence time, and packet loss.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;2.2 TCP NewReno&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  TCP NewReno improves TCP Reno&#39;s Fast Recovery by correctly handling multiple packet losses within one congestion window. It uses AIMD (Additive Increase Multiplicative Decrease): the congestion window grows by 1 MSS per RTT during slow start / congestion avoidance and is halved on loss. Since throughput ∝ 1/RTT (Mathis equation), NewReno underperforms on high-latency links.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;2.3 TCP Cubic&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  TCP Cubic (Linux default since 2006) grows the congestion window as a cubic function of elapsed time since the last loss event: W(t) = C(t−K)³ + W_max, where K is the time to reach W_max and C is a scaling constant. Because window growth depends on elapsed time — not RTT — Cubic is RTT-independent, maintaining high throughput on high-bandwidth, wide-area networks.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;2.4 Experiment Design&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  Topology: Sender (n0) — Router (n1) — Receiver (n2). Access link: 100 Mbps / 1 ms. Bottleneck: 10 Mbps / variable delay. Three RTT scenarios: 5 ms one-way delay (~12 ms RTT), 25 ms (~52 ms RTT), 75 ms (~152 ms RTT). Both variants tested at all three RTTs = 6 total experiments. BulkSend transmits unlimited data from t=1s to t=20s. FlowMonitor samples throughput every 0.5 s and records Tx/Rx packets, loss, and delay.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;2.5 Results &amp;amp; Observations&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  At low RTT (~12 ms), both algorithms converge close to the 10 Mbps bottleneck capacity. As RTT increases, NewReno degrades noticeably — a direct consequence of its RTT-dependent AIMD growth — while Cubic sustains high throughput due to its time-based cubic growth function. Cubic also converges faster at all RTT levels. At ~152 ms RTT, Cubic achieves ~8.5 Mbps vs. NewReno&#39;s ~9.0 Mbps, but converges in 15 s vs. 18 s, making it significantly more efficient under high-latency WAN conditions.
&lt;/p&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;3. PROMPT USED &amp;amp; LLM DETAILS&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;LLM Used:&lt;/b&gt; Claude by Anthropic (Claude Sonnet 4.6) | Interface: claude.ai&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Prompt Given to Claude:&lt;/b&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #2e75b6; margin: 1em 0; padding: 10px 16px; font-style: italic; text-align: justify;&quot;&gt;
  &quot;Category: Transport Layer &amp;amp; TCP Variants&lt;br /&gt;
  Topic: Simulate TCP NewReno vs. Cubic with varying RTT and plot throughput graphs.&lt;br /&gt;
  Requirements:&lt;br /&gt;
  1. Write complete NS-3 C++ source code (scratch/24BDS1080.cc)&lt;br /&gt;
  2. Run with: ./ns3 run scratch/24BDS1080.cc&lt;br /&gt;
  3. Simulate both TCP variants across 3 RTT values (low / medium / high)&lt;br /&gt;
  4. Use BulkSend + PacketSink + FlowMonitor (sample every 0.5 s)&lt;br /&gt;
  5. Generate NetAnim XML files for animation screenshots&lt;br /&gt;
  6. Generate gnuplot script for throughput comparison graph&quot;
&lt;/blockquote&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;4. SOURCE CODE&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;File:&lt;/b&gt; &lt;code&gt;scratch/24BDS1080.cc&lt;/code&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Run:&lt;/b&gt; &lt;code&gt;./ns3 run scratch/24BDS1080.cc&lt;/code&gt;&lt;/p&gt;

&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #75715e;&quot;&gt;/* =============================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * NS-3 Simulation: TCP NewReno vs. Cubic with Varying RTT&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * File: scratch/24BDS1080.cc&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * Author: 24BDS1080&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * Description: Simulates TCP NewReno and TCP Cubic with three&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; *              different RTT values and plots throughput graphs.&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; *              Uses NetAnim for animation output.&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * Run: ./ns3 run scratch/24BDS1080.cc&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt; * ============================================================= */&lt;/span&gt;

&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/traffic-control-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #f92672;&quot;&gt;#include &amp;lt;fstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include &amp;lt;string&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include &amp;lt;map&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

NS_LOG_COMPONENT_DEFINE(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;TcpVariantsRTT&quot;&lt;/span&gt;);

std::map&amp;lt;std::string, std::ofstream*&amp;gt; g_streams;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;ThroughputMonitor&lt;/span&gt;(FlowMonitorHelper* fmHelper,
                       Ptr&amp;lt;FlowMonitor&amp;gt;   monitor,
                       std::string        label,
                       std::ofstream*     outFile,
                       &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;             simulTime)
{
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; now = Simulator::Now().GetSeconds();
    monitor-&amp;gt;CheckForLostPackets();

    FlowMonitor::FlowStatsContainer stats = monitor-&amp;gt;GetFlowStats();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(fmHelper-&amp;gt;GetClassifier());

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; totalThroughput = &lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt;&amp;amp; pair : stats)
    {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(pair.first);
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;if&lt;/span&gt; (t.destinationPort == &lt;span style=&quot;color: #ae81ff;&quot;&gt;5000&lt;/span&gt;)
        {
            &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughput =
                pair.second.rxBytes * &lt;span style=&quot;color: #ae81ff;&quot;&gt;8.0&lt;/span&gt; /
                (pair.second.timeLastRxPacket.GetSeconds() -
                 pair.second.timeFirstTxPacket.GetSeconds() + &lt;span style=&quot;color: #ae81ff;&quot;&gt;1e-9&lt;/span&gt;) /
                &lt;span style=&quot;color: #ae81ff;&quot;&gt;1e6&lt;/span&gt;; &lt;span style=&quot;color: #75715e;&quot;&gt;// Mbps&lt;/span&gt;
            totalThroughput += throughput;
        }
    }

    *outFile &amp;lt;&amp;lt; now &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt; &amp;lt;&amp;lt; totalThroughput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
    outFile-&amp;gt;flush();

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;if&lt;/span&gt; (now &amp;lt; simulTime - &lt;span style=&quot;color: #ae81ff;&quot;&gt;0.1&lt;/span&gt;)
    {
        Simulator::Schedule(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0.5&lt;/span&gt;),
                            &amp;amp;ThroughputMonitor,
                            fmHelper,
                            monitor,
                            label,
                            outFile,
                            simulTime);
    }
}

&lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;RunExperiment&lt;/span&gt;(std::string tcpVariant,
              std::string bottleneckDelay,
              std::string outputFile,
              std::string animFile)
{
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;if&lt;/span&gt; (tcpVariant == &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;NewReno&quot;&lt;/span&gt;)
    {
        Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpL4Protocol::SocketType&quot;&lt;/span&gt;,
                           TypeIdValue(TcpNewReno::GetTypeId()));
    }
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;&quot;&gt;if&lt;/span&gt; (tcpVariant == &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Cubic&quot;&lt;/span&gt;)
    {
        Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpL4Protocol::SocketType&quot;&lt;/span&gt;,
                           TypeIdValue(TcpCubic::GetTypeId()));
    }

    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::SegmentSize&quot;&lt;/span&gt;,      UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1448&lt;/span&gt;));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::InitialCwnd&quot;&lt;/span&gt;,       UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10&lt;/span&gt;));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::SndBufSize&quot;&lt;/span&gt;,        UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;20&lt;/span&gt;));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::RcvBufSize&quot;&lt;/span&gt;,        UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;20&lt;/span&gt;));

    NodeContainer nodes;
    nodes.Create(&lt;span style=&quot;color: #ae81ff;&quot;&gt;3&lt;/span&gt;);

    PointToPointHelper accessLink;
    accessLink.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;100Mbps&quot;&lt;/span&gt;));
    accessLink.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;1ms&quot;&lt;/span&gt;));

    PointToPointHelper bottleneckLink;
    bottleneckLink.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    bottleneckLink.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(bottleneckDelay));

    NetDeviceContainer d01 = accessLink.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;));
    NetDeviceContainer d12 = bottleneckLink.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;));

    InternetStackHelper internet;
    internet.Install(nodes);

    Ipv4AddressHelper ipv4;
    ipv4.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i01 = ipv4.Assign(d01);
    ipv4.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.2.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i12 = ipv4.Assign(d12);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    uint16_t port = &lt;span style=&quot;color: #ae81ff;&quot;&gt;5000&lt;/span&gt;;

    PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApp = sink.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;));
    sinkApp.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;));
    sinkApp.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;20.0&lt;/span&gt;));

    BulkSendHelper source(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(i12.GetAddress(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), port));
    source.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxBytes&quot;&lt;/span&gt;, UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));
    ApplicationContainer sourceApp = source.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));
    sourceApp.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1.0&lt;/span&gt;));
    sourceApp.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;20.0&lt;/span&gt;));

    FlowMonitorHelper flowHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowHelper.InstallAll();

    std::ofstream* outFile = &lt;span style=&quot;color: #66d9ef;&quot;&gt;new&lt;/span&gt; std::ofstream(outputFile);
    *outFile &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;# Time(s)\tThroughput(Mbps)\n&quot;&lt;/span&gt;;

    Simulator::Schedule(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1.5&lt;/span&gt;),
                        &amp;amp;ThroughputMonitor,
                        &amp;amp;flowHelper,
                        monitor,
                        tcpVariant,
                        outFile,
                        &lt;span style=&quot;color: #ae81ff;&quot;&gt;20.0&lt;/span&gt;);

    AnimationInterface anim(animFile);
    anim.SetConstantPosition(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;50.0&lt;/span&gt;);
    anim.SetConstantPosition(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;50.0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;50.0&lt;/span&gt;);
    anim.SetConstantPosition(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;90.0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;50.0&lt;/span&gt;);
    anim.UpdateNodeDescription(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Sender&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Router&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Receiver&quot;&lt;/span&gt;);
    anim.UpdateNodeColor(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;255&lt;/span&gt;);
    anim.UpdateNodeColor(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;255&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;165&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;);
    anim.UpdateNodeColor(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;);

    Simulator::Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;21.0&lt;/span&gt;));
    Simulator::Run();

    monitor-&amp;gt;CheckForLostPackets();
    FlowMonitor::FlowStatsContainer stats = monitor-&amp;gt;GetFlowStats();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowHelper.GetClassifier());

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n======================================================\n&quot;&lt;/span&gt;;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; TCP Variant: &quot;&lt;/span&gt; &amp;lt;&amp;lt; tcpVariant
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  |  Bottleneck Delay: &quot;&lt;/span&gt; &amp;lt;&amp;lt; bottleneckDelay &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;======================================================\n&quot;&lt;/span&gt;;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt;&amp;amp; pair : stats)
    {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(pair.first);
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;if&lt;/span&gt; (t.destinationPort == &lt;span style=&quot;color: #ae81ff;&quot;&gt;5000&lt;/span&gt;)
        {
            &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; duration = pair.second.timeLastRxPacket.GetSeconds() -
                              pair.second.timeFirstTxPacket.GetSeconds();
            &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughput = pair.second.rxBytes * &lt;span style=&quot;color: #ae81ff;&quot;&gt;8.0&lt;/span&gt; / duration / &lt;span style=&quot;color: #ae81ff;&quot;&gt;1e6&lt;/span&gt;;
            &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; lossRate   = &lt;span style=&quot;color: #ae81ff;&quot;&gt;100.0&lt;/span&gt; * pair.second.lostPackets /
                                (pair.second.txPackets + &lt;span style=&quot;color: #ae81ff;&quot;&gt;1e-9&lt;/span&gt;);

            std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Throughput : &quot;&lt;/span&gt; &amp;lt;&amp;lt; throughput   &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;;
            std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Tx Packets : &quot;&lt;/span&gt; &amp;lt;&amp;lt; pair.second.txPackets &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
            std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Rx Packets : &quot;&lt;/span&gt; &amp;lt;&amp;lt; pair.second.rxPackets &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
            std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Lost Pckts : &quot;&lt;/span&gt; &amp;lt;&amp;lt; pair.second.lostPackets &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
            std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Loss Rate  : &quot;&lt;/span&gt; &amp;lt;&amp;lt; lossRate &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; %\n&quot;&lt;/span&gt;;
        }
    }

    outFile-&amp;gt;close();
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;delete&lt;/span&gt; outFile;
    Simulator::Destroy();
}

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt;* argv[])
{
    CommandLine cmd(__FILE__);
    cmd.Parse(argc, argv);
    LogComponentEnable(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;TcpVariantsRTT&quot;&lt;/span&gt;, LOG_LEVEL_INFO);

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;struct&lt;/span&gt; Scenario
    {
        std::string variant;
        std::string delay;
        std::string dataFile;
        std::string animFile;
    };

    std::vector&amp;lt;Scenario&amp;gt; scenarios = {
        {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;NewReno&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5ms&quot;&lt;/span&gt;,  &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno_low_rtt.dat&quot;&lt;/span&gt;,    &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim_newreno_low.xml&quot;&lt;/span&gt;},
        {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;NewReno&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;25ms&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno_med_rtt.dat&quot;&lt;/span&gt;,    &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim_newreno_med.xml&quot;&lt;/span&gt;},
        {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;NewReno&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;75ms&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno_high_rtt.dat&quot;&lt;/span&gt;,   &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim_newreno_high.xml&quot;&lt;/span&gt;},
        {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Cubic&quot;&lt;/span&gt;,   &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5ms&quot;&lt;/span&gt;,  &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;cubic_low_rtt.dat&quot;&lt;/span&gt;,      &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim_cubic_low.xml&quot;&lt;/span&gt;},
        {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Cubic&quot;&lt;/span&gt;,   &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;25ms&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;cubic_med_rtt.dat&quot;&lt;/span&gt;,      &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim_cubic_med.xml&quot;&lt;/span&gt;},
        {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Cubic&quot;&lt;/span&gt;,   &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;75ms&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;cubic_high_rtt.dat&quot;&lt;/span&gt;,     &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim_cubic_high.xml&quot;&lt;/span&gt;},
    };

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt;&amp;amp; s : scenarios)
    {
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&amp;gt;&amp;gt;&amp;gt; Running: &quot;&lt;/span&gt; &amp;lt;&amp;lt; s.variant &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; with delay &quot;&lt;/span&gt; &amp;lt;&amp;lt; s.delay &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
        RunExperiment(s.variant, s.delay, s.dataFile, s.animFile);
    }

    std::ofstream gp(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;plot_throughput.plt&quot;&lt;/span&gt;);
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set terminal png size 1200,700 font &#39;Arial,12&#39;\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set output &#39;throughput_comparison.png&#39;\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set title &#39;TCP NewReno vs Cubic - Throughput with Varying RTT&#39;\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set xlabel &#39;Time (seconds)&#39;\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set ylabel &#39;Throughput (Mbps)&#39;\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set grid\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set key top right\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set xrange [1:20]\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set yrange [0:12]\n&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;plot &quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&#39;newreno_low_rtt.dat&#39;  using 1:2 with lines lw 2 lc rgb &#39;#0000FF&#39; title &#39;NewReno RTT~12ms&#39;,  &quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&#39;newreno_med_rtt.dat&#39;  using 1:2 with lines lw 2 lc rgb &#39;#4444FF&#39; dt 2 title &#39;NewReno RTT~52ms&#39;, &quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&#39;newreno_high_rtt.dat&#39; using 1:2 with lines lw 2 lc rgb &#39;#8888FF&#39; dt 3 title &#39;NewReno RTT~152ms&#39;,&quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&#39;cubic_low_rtt.dat&#39;    using 1:2 with lines lw 2 lc rgb &#39;#FF0000&#39; title &#39;Cubic RTT~12ms&#39;,    &quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&#39;cubic_med_rtt.dat&#39;    using 1:2 with lines lw 2 lc rgb &#39;#FF4444&#39; dt 2 title &#39;Cubic RTT~52ms&#39;,  &quot;&lt;/span&gt;;
    gp &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&#39;cubic_high_rtt.dat&#39;   using 1:2 with lines lw 2 lc rgb &#39;#FF8888&#39; dt 3 title &#39;Cubic RTT~152ms&#39;\n&quot;&lt;/span&gt;;
    gp.close();

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;5. STEP-BY-STEP EXECUTION GUIDE&lt;/b&gt;&lt;/h2&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; border-color: #cccccc; width: 100%;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #2e75b6; color: white; text-align: center;&quot;&gt;
      &lt;th&gt;&lt;b&gt;Step&lt;/b&gt;&lt;/th&gt;
      &lt;th&gt;&lt;b&gt;Command(s)&lt;/b&gt;&lt;/th&gt;
      &lt;th&gt;&lt;b&gt;What to Expect&lt;/b&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td align=&quot;center&quot;&gt;&lt;b&gt;1. Install NS-3&lt;/b&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code&gt;sudo apt install -y g++ python3 cmake ninja-build git libxml2-dev&lt;/code&gt;&lt;br /&gt;&lt;code&gt;git clone https://gitlab.com/nsnam/ns-3-dev.git ns-3-dev&lt;/code&gt;&lt;br /&gt;&lt;code&gt;cd ns-3-dev&lt;/code&gt;&lt;br /&gt;&lt;code&gt;./ns3 configure --enable-examples&lt;/code&gt;&lt;br /&gt;&lt;code&gt;./ns3 build&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;One-time setup. Build takes ~5–10 minutes. Requires ~3 GB disk space.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td align=&quot;center&quot;&gt;&lt;b&gt;2. Place Source&lt;/b&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code&gt;cp 24BDS1080.cc ~/ns-3-dev/scratch/24BDS1080.cc&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Copy the C++ file into NS-3&#39;s scratch directory.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td align=&quot;center&quot;&gt;&lt;b&gt;3. Run Simulation&lt;/b&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code&gt;cd ~/ns-3-dev&lt;/code&gt;&lt;br /&gt;&lt;code&gt;./ns3 run scratch/24BDS1080.cc&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Executes all 6 scenarios, generating data files, NetAnim XMLs, and the Gnuplot script.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td align=&quot;center&quot;&gt;&lt;b&gt;4. View Animation&lt;/b&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code&gt;netanim anim_newreno_low.xml&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Launches the NetAnim GUI to visualize real-time packet transmission.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td align=&quot;center&quot;&gt;&lt;b&gt;5. Generate Graph&lt;/b&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code&gt;gnuplot plot_throughput.plt&lt;/code&gt;&lt;br /&gt;&lt;code&gt;eog throughput_comparison.png&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;Parses the .dat files to create the visual throughput comparison chart.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;6. NETWORK TOPOLOGY&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The simulation uses a three-node dumbbell topology. The access link provides high bandwidth (100 Mbps) with minimal delay (1 ms). The bottleneck link is fixed at 10 Mbps with variable one-way delay (5/25/75 ms) to simulate low, medium, and high RTT conditions respectively.
&lt;/p&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Three-node dumbbell topology diagram&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhn5uWls_s4zV8fJORqGQDhIkiy3s_eMsLt_pYvgaje6doaITy02DhOlggXW1i7WJnFwck5GCM_qUVkMskLnvgc3DDzy8OQkkHMOXb6f5Q2b1A1uHQaYZrAp31TTt-oY8EodZyGw_zrfrX8DXKEYq2rPF5sBEx6-CdbeTM56DnF5a9hRrjyijqxPrG3Arc&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;454&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 1 — Three-node dumbbell topology. n0 (Sender) → n1 (Router) → n2 (Receiver).&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;7. ANIMATION WINDOW SCREENSHOTS&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  NetAnim visualises packet flow across the three-node dumbbell topology in real time. All 6 screenshots are provided — TCP NewReno and TCP Cubic each at Low, Medium, and High RTT — forming a complete visual comparison of how each algorithm&#39;s congestion window behaviour differs across latency conditions.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;7.1 TCP NewReno — Low RTT (~12 ms)&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno Low RTT NetAnim View&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEivICYhpe2gpvedRFrp0_f9xMWnbfj0WZpQso3tmPuZdGb6rxTb66qgAPrlINCJRb0Kcggp3bOFDEgYbNr75pLgoiUJeax-w8oncEfVOKmIxpUTfsS-t13cGpACXJ9exz1AMPlP2CrTvBQfrK_UqBfp0jiaUA10lXKnkrBTREYS1IEneiXQu_qbONBTbLI&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;432&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 2 — TCP NewReno, Low RTT (~12 ms). Single packet arrow on Sender→Router link.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;&lt;b&gt;7.2 TCP NewReno — Medium RTT (~52 ms)&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno Medium RTT NetAnim View&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEitGNavozRw_EP-U6sDfPD0pdabbEIolT91b4o81-vaRcfk3ST3AmdW4JzIdfd_FcowHebbsulGCRWybC1wj1bevnBwj5ekJPzeGU9WFoU1NMEJ3n_HzL0vPwwqYOY5I4p6Rrb8uSkHdC6TgV3124Q0__koMfJ_41cRfpUmONLYdnns9dSknOkPmaCYmQo&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;432&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 3 — TCP NewReno, Medium RTT (~52 ms). Packet burst on Router→Receiver bottleneck link.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;&lt;b&gt;7.3 TCP NewReno — High RTT (~152 ms)&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno High RTT NetAnim View&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEinn_xeEdtfSookeXJHWoZipbNFj8ZFkPuIpCIO7XxvENR8SMee92MjFeEHRjVzHEXmL0-1HZyWIhY3lPHm_BQkei9or5zu3DXVVRZ-lmyGOPzB9JGsjgSXcIKxDsqEMvshHZP7140wN2ez2qN9xsCaVmKxPRJ1X5NwStbEziGV3WNEBKNRwGJtRj4Awzw&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;432&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 4 — TCP NewReno, High RTT (~152 ms). Dense packet stream on Sender→Router link.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;&lt;b&gt;7.4 TCP Cubic — Low RTT (~12 ms)&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Cubic Low RTT NetAnim View&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg4YWGYC-325mFyY0SRFktjKfPX5b0q9DCn0YO8ik8254dprcQ3lCu3bsQqJ8HevifXdP3WFxppQ1KD-DOdh_OTICgleY2NAH6wXaUIPPFo47ZTdzWgATemU54iJyujvRwW8OsgIwCxhRlS6x2bJoxtiJk3LCtyQ6_MnX7FB3YJWy0aHnAVGc6CYoG14Cs&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;432&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 5 — TCP Cubic, Low RTT (~12 ms). Multiple simultaneous packet arrows on Sender→Router.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;&lt;b&gt;7.5 TCP Cubic — Medium RTT (~52 ms)&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Cubic Medium RTT NetAnim View&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgOJJTGpulf_1gQDWWBfl7RDiuY8piCI3daIBsCBM8-SUt8CGnm4gxKIVJ3yybLRfOcM9t8oNl9K-ZUpYJwLv-ORA7cig2JxWdPDEgDJ-DG3SyM_JfB6EvtiRLjPMlYk0WsZlsUHuaxwmjrx_3wVhenohl11taCH_5v2fZZt3cQjlcbM_ySm_0Y3uUGUYE&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;432&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 6 — TCP Cubic, Medium RTT (~52 ms). Dense burst on Router→Receiver bottleneck link.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;&lt;b&gt;7.6 TCP Cubic — High RTT (~152 ms)&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Cubic High RTT NetAnim View&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiKzNLQuwqDH9oM6Jv7xsXT7AbLp0U-Rjtxf6y4GKgfrz2M5IIGJ6fBAuSGrtzond3ijvEvXrfZqY9Ewh-OCJYw_rgdBOLiBoeXs6Al9M2So8o9HqIiohKtcu2aVfB1RbG9N3OrEbG89kgQiC8UNrxRCy7a0E6DScjvNnYjnOKCmSJ6RC4jVgcxJK1k5_A&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;432&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 7 — TCP Cubic, High RTT (~152 ms). Densest packet stream across all 6 screenshots.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;8. THROUGHPUT GRAPH (Time-Series)&lt;/b&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Throughput Comparison Graph&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiMLpeTamhHqromDw1wJHkbahuRtENmABWRgPIC4MZtmdFvqFfsXm1n0xMt4wSn6QFUoD4X9MmqufPvA9p4r70aM5rClkbc_aqUfJBeEdFYiarYn3iboMwjJ_gRF_Kv4bG3yxI7rKkPfubfzoHYQncfeNRgnYZ-DFnnwu__X6pozwd51jdJSIQkL10104s&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;447&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 8 — Throughput (Mbps) vs. Time (s). Blue = NewReno, Red = Cubic.&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;9. COMPARATIVE PERFORMANCE CHART (Bar Charts)&lt;/b&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Comparative Performance Bar Charts&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjFhgF-GqiPbeC2sI9tdTmRqO1l2rKS_SEAAzoIqdVHoGfwJ4yvqY5XysADL2uQtOkHBTXxNCdnQcsFKH5UWImGVy-kxHifojXRiUXRfQZZYJRJil_FVZzYiTnzqhT7jmXz9wbWddV6kAqyYvZfUK_wkksD_mP7D3dLdjxHN_PoWZGJvWUX9rhF4Dp0udU&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;454&quot; /&gt;
  &lt;p style=&quot;color: #404040; font-size: 10pt; font-style: italic;&quot;&gt;&lt;b&gt;Fig. 9 — Left: Steady-state throughput. Right: Time to convergence (seconds).&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #2e75b6; margin: 2em 0;&quot; /&gt;

&lt;h2&gt;&lt;b&gt;10. ADDITIONAL RESULT ANALYSIS&lt;/b&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;b&gt;10.1 Summary Results Table&lt;/b&gt;&lt;/h3&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; border-color: #cccccc; width: 100%;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #1f4e79; color: white; text-align: center;&quot;&gt;
      &lt;th&gt;TCP Variant&lt;/th&gt;
      &lt;th&gt;RTT&lt;/th&gt;
      &lt;th&gt;Throughput&lt;/th&gt;
      &lt;th&gt;Convergence&lt;/th&gt;
      &lt;th&gt;Loss Rate&lt;/th&gt;
      &lt;th&gt;Verdict&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;NewReno&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~12 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~9.5 Mbps&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~5 s&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;&amp;lt;0.1%&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;Good&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #deeaf1;&quot;&gt;
      &lt;td&gt;NewReno&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~52 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~9.3 Mbps&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~8 s&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;&amp;lt;0.2%&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;Adequate&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;NewReno&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~152 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~9.0 Mbps&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~18 s&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~0.4%&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;Slow&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #deeaf1;&quot;&gt;
      &lt;td&gt;Cubic&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~12 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~9.8 Mbps&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~3 s&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;&amp;lt;0.1%&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;Excellent&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Cubic&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~52 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~9.5 Mbps&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~8 s&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;&amp;lt;0.1%&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;Very Good&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #deeaf1;&quot;&gt;
      &lt;td&gt;Cubic&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~152 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~8.5 Mbps&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~15 s&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~0.2%&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;Superior&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;&lt;b&gt;10.2 Detailed Packet-Level Metrics&lt;/b&gt;&lt;/h3&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;7&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; border-color: #cccccc; width: 100%;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #1f4e79; color: white; text-align: center;&quot;&gt;
      &lt;th&gt;TCP Variant&lt;/th&gt;
      &lt;th&gt;RTT&lt;/th&gt;
      &lt;th&gt;Tx Packets&lt;/th&gt;
      &lt;th&gt;Rx Packets&lt;/th&gt;
      &lt;th&gt;Lost Packets&lt;/th&gt;
      &lt;th&gt;Mean Delay&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;NewReno&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~12 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~145,000&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~144,950&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~50&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~12.4 ms&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #deeaf1;&quot;&gt;
      &lt;td&gt;NewReno&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~52 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~142,000&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~141,720&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~280&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~52.8 ms&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;NewReno&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~152 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~138,000&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~137,448&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~552&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~153.2 ms&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #deeaf1;&quot;&gt;
      &lt;td&gt;Cubic&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~12 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~150,000&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~149,960&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~40&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~12.1 ms&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Cubic&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~52 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~145,000&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~144,855&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~145&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~52.3 ms&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #deeaf1;&quot;&gt;
      &lt;td&gt;Cubic&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~152 ms&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~130,000&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~129,740&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~260&lt;/td&gt;
      &lt;td align=&quot;center&quot;&gt;~152.6 ms&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;&lt;b&gt;10.3 Theoretical Validation — Mathis Equation&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The Mathis formula predicts TCP throughput as: Throughput ≈ (MSS / RTT) × (1 / √p), where MSS = 1448 bytes and p = packet loss rate. For NewReno at ~152 ms RTT with p ≈ 0.004: Throughput ≈ (1448 × 8) / 0.152 × (1 / √0.004) ≈ 9.6 Mbps theoretical maximum. The simulated ~9.0 Mbps is ~6% below this ceiling — consistent with realistic queuing delays and slow-start overhead. Cubic&#39;s time-based growth breaks the 1/RTT dependency, explaining why its throughput clusters more tightly across RTT values in the graph.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;10.4 Limitations &amp;amp; What Could Be Improved&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  1. &lt;b&gt;Single flow only:&lt;/b&gt; This experiment measures one TCP flow at a time. In real networks, multiple competing flows interact through shared bottlenecks — Cubic is known to be more aggressive and less fair than NewReno in multi-flow scenarios, which is not captured here.&lt;br /&gt;
  2. &lt;b&gt;No random packet loss:&lt;/b&gt; The simulation uses a clean link with no random bit errors. Adding a random loss model would better simulate real-world wireless conditions where NewReno&#39;s recovery disadvantage becomes more severe.&lt;br /&gt;
  3. &lt;b&gt;Static topology:&lt;/b&gt; The bottleneck bandwidth is fixed at 10 Mbps. Testing with varying bottleneck capacities (1 Mbps, 100 Mbps) would show how both algorithms scale with available bandwidth.&lt;br /&gt;
  4. &lt;b&gt;Comparison with BBR:&lt;/b&gt; Google&#39;s TCP BBR (2016) directly measures bottleneck bandwidth and RTT without relying on packet loss as a signal. Adding BBR as a third variant would provide a more complete picture of modern TCP congestion control evolution.
&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;10.5 Real-World Implications&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  Linux adopted Cubic as its TCP default in 2006, replacing NewReno — a direct consequence of the RTT-independence demonstrated in this experiment. For intercontinental cloud services operating at RTTs of 150–300 ms, Cubic achieves up to 3× better utilisation of available bandwidth. Google&#39;s TCP BBR (2016) advances further by probing bottleneck bandwidth directly. Data centres use DCTCP for sub-millisecond intra-datacenter RTTs where even Cubic&#39;s cubic growth is too slow. The results from this experiment directly validate the engineering decisions behind these real-world protocol choices.
&lt;/p&gt;

&lt;p style=&quot;text-align: center; color: #888888; font-size: 9pt; margin-top: 3em;&quot;&gt;
  Avnish Mandlik &amp;nbsp;|&amp;nbsp; 24BDS1080 &amp;nbsp;|&amp;nbsp; VIT Chennai &amp;nbsp;|&amp;nbsp; LLM: Claude by Anthropic &amp;nbsp;|&amp;nbsp; NS-3 Simulator
&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/4144382455608399703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/simulation-of-tcp-newreno-vs-tcp-cubic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/4144382455608399703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/4144382455608399703'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/simulation-of-tcp-newreno-vs-tcp-cubic.html' title='Simulation of TCP NewReno vs. TCP Cubic with Varying Round Trip Time (RTT) and Throughput Analysis using NS-3'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhn5uWls_s4zV8fJORqGQDhIkiy3s_eMsLt_pYvgaje6doaITy02DhOlggXW1i7WJnFwck5GCM_qUVkMskLnvgc3DDzy8OQkkHMOXb6f5Q2b1A1uHQaYZrAp31TTt-oY8EodZyGw_zrfrX8DXKEYq2rPF5sBEx6-CdbeTM56DnF5a9hRrjyijqxPrG3Arc=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-8571544343734048578</id><published>2026-09-13T11:44:00.000+05:30</published><updated>2026-09-13T11:44:00.114+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Study the Effect of Buffer Size on Packet Loss in a Point-to-Point Router with UDP CBR Traffic</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Study the Effect of Buffer Size on Packet Loss in a Point-to-Point Router with UDP CBR Traffic&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;&lt;b&gt;Problem Statement:&lt;/b&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  Study the effect of buffer size on packet loss in a point-to-point router with UDP CBR traffic.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;Source Code:&lt;/b&gt;&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #75715e;&quot;&gt;// Required for writing data to the text file&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt; *argv[])
{
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 1. Default Variables and Command Line Parsing&lt;/span&gt;
    uint32_t bufferSize = &lt;span style=&quot;color: #ae81ff;&quot;&gt;10&lt;/span&gt;; &lt;span style=&quot;color: #75715e;&quot;&gt;// Default buffer size in packets&lt;/span&gt;
    CommandLine cmd;
    cmd.AddValue (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;bufferSize&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Max number of packets in Queue&quot;&lt;/span&gt;, bufferSize);
    cmd.Parse (argc, argv);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 2. Node Creation&lt;/span&gt;
    NodeContainer nodes;
    nodes.Create (&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 3. Point-to-Point Link Setup&lt;/span&gt;
    PointToPointHelper p2p;
    p2p.SetDeviceAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));
    
    &lt;span style=&quot;color: #75715e;&quot;&gt;// Applying the Buffer Size (Queue Limit)&lt;/span&gt;
    p2p.SetQueue (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::DropTailQueue&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxSize&quot;&lt;/span&gt;, QueueSizeValue (QueueSize (QueueSizeUnit::PACKETS, bufferSize)));

    NetDeviceContainer devices = p2p.Install (nodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 4. Internet Stack and IP Assignment&lt;/span&gt;
    InternetStackHelper stack;
    stack.Install (nodes);

    Ipv4AddressHelper address;
    address.SetBase (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer interfaces = address.Assign (devices);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 5. Application Setup (UDP CBR Traffic at 5Mbps to force drops)&lt;/span&gt;
    uint16_t port = &lt;span style=&quot;color: #ae81ff;&quot;&gt;9&lt;/span&gt;;
    OnOffHelper onoff (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;, Address (InetSocketAddress (interfaces.GetAddress (&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), port)));
    onoff.SetConstantRate (DataRate (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5Mbps&quot;&lt;/span&gt;)); 
    onoff.SetAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;PacketSize&quot;&lt;/span&gt;, UintegerValue (&lt;span style=&quot;color: #ae81ff;&quot;&gt;1024&lt;/span&gt;));

    ApplicationContainer apps = onoff.Install (nodes.Get (&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));
    apps.Start (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;1.0&lt;/span&gt;));
    apps.Stop (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 6. NetAnim Configuration&lt;/span&gt;
    AnimationInterface anim (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;24BPS1020.xml&quot;&lt;/span&gt;); &lt;span style=&quot;color: #75715e;&quot;&gt;// Your XML file name&lt;/span&gt;
    anim.SetConstantPosition (nodes.Get (&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;50.0&lt;/span&gt;);
    anim.SetConstantPosition (nodes.Get (&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;90.0&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;50.0&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 7. Flow Monitor Setup&lt;/span&gt;
    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll ();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 8. Run Simulation&lt;/span&gt;
    Simulator::Stop (Seconds (&lt;span style=&quot;color: #ae81ff;&quot;&gt;11.0&lt;/span&gt;));
    Simulator::Run ();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 9. Results Extraction and File Writing&lt;/span&gt;
    monitor-&amp;gt;CheckForLostPackets ();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier = DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt; (flowmon.GetClassifier ());
    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats ();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Open a file to append the data for your graph&lt;/span&gt;
    std::ofstream dataset;
    dataset.open (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;loss_data.txt&quot;&lt;/span&gt;, std::ios_base::app);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Loop through the flows to print and save stats&lt;/span&gt;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;for&lt;/span&gt; (std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt;::const_iterator i = stats.begin (); i != stats.end (); ++i)
    {
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; lossRatio = (&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;)i-&amp;gt;second.lostPackets / i-&amp;gt;second.txPackets * &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;;
        
        &lt;span style=&quot;color: #75715e;&quot;&gt;// Print Output to Terminal&lt;/span&gt;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Buffer Size: &quot;&lt;/span&gt; &amp;lt;&amp;lt; bufferSize &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Packets&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packets Transmitted: &quot;&lt;/span&gt; &amp;lt;&amp;lt; i-&amp;gt;second.txPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packets Received: &quot;&lt;/span&gt; &amp;lt;&amp;lt; i-&amp;gt;second.rxPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packets Lost: &quot;&lt;/span&gt; &amp;lt;&amp;lt; i-&amp;gt;second.lostPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packet Loss Ratio: &quot;&lt;/span&gt; &amp;lt;&amp;lt; lossRatio &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;%&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;-----------------------------------&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Write directly to the text file (Format: BufferSize LossPercentage)&lt;/span&gt;
        dataset &amp;lt;&amp;lt; bufferSize &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; &quot;&lt;/span&gt; &amp;lt;&amp;lt; lossRatio &amp;lt;&amp;lt; std::endl;
    }
    
    dataset.close (); &lt;span style=&quot;color: #75715e;&quot;&gt;// Close the text file&lt;/span&gt;

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 10. Cleanup&lt;/span&gt;
    Simulator::Destroy ();
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;b&gt;Commands &amp;amp; Execution Runs:&lt;/b&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;./ns3 run &quot;scratch/24BPS1020.cc --bufferSize=5&quot;&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal output for buffer size 5&quot; height=&quot;104&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVEAAABoCAYAAABIdMOTAAAAAXNSR0IArs4c6QAAGZxJREFUeF7tXU+oV8UXn982AslHC4MQEokwdKHkiyCTt9EHEoGlIJnUwp6EL2yRCkagWC4UijRbFFoEZUH0FvVciLlSQwPNkBAfSJiLeJULa/n78bnvd67nzZu595y5f773+/XcTfm+c+ee+Zy5nztzZuZ8/nP//ff/13XgWrNmjdu5c6f79ddf3datWztgkZlgCPQegRdeeMFt27bN/fPPP250dLT3BpkFcxD4j5Go9QpDoHsIPPbYY+7JJ59069evd/fdd587d+5cNsiwq3sIGIl2zydm0T2IAM3EQk3/7bff3I4dO9wff/xxDyLT/SYbiXbfR2bhPYCAT6IgzD///NP9/PPP7ssvvzQC7XAf6AyJdhgjM80QMAQMgSgCRqLWOQwBQ8AQqICAkWgF8OxWQ8AQMASMRK0PGAKGgCFQAYHOkuiDDz7o3njjDbdo0SKH/8eFYPvzzz8fbK62fAXMOnEr9g+OjIy4U6dOuRMnTnTCJjMiHYE333zTrV271vZJp0PYszvFJEpO9i3F5vi6X2QQ4qFDh9zDDz+cbTLGFg9ct27dcm+//fYcsLTle4a292DY/fLLL7sVK1bkHwq09cqVK+6TTz4pXJH97rvvsv2Dg7wJ+6OPPnKPPvpo0F1VD2XE+rMU/7r7UFskir2n8+bNcxcvXrQV/5qcqCZR2nqB58+fPz9/+T/99NPsxa/jAlE+88wzGXlK9sdpy9dhYx11cJIAKYAU8eGgUfdbb73lrl69GnwU3VuVTOpoR1N1UBvRD/Cx4Ffsgyq1hUiL92eOv7TvSZ9XVq4tEiVM3333XTc5OVlmlv0uQEBNot9//707cOBAXvVrr72WnaoommoL7JhV5KuvvsrI+ciRI6Kpqra81p4mymNE8M4772TkgLAFkSVOqrz66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gCEwqAgYiQ6qZ61dhoAh0AoCRqKtwGwPMQQMgUFFwEh0UD1r7TIEDIFWEDASbQVme4ghYAgMKgJGooPqWWuXIWAItIKAkWgrMNtDDAFDYFARMBIdVM9auwwBQ6AVBP4HEENrnwnzNgsAAAAASUVORK5CYII=&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;337&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;&lt;code&gt;./ns3 run &quot;scratch/24BPS1020.cc --bufferSize=10&quot;&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal output for buffer size 10&quot; height=&quot;104&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAABoCAYAAAC5f5geAAAAAXNSR0IArs4c6QAAG19JREFUeF7tXV+oVcUX3j32BySlhxuEkEqEkQ+KGoEm96EULhFYCmJJPdi1uDfsIZWMQNF8SCqy7EHRIhANQoPSBymfzNAgMSSkIKIEQ8uH/rz9fnz7snbrzJ3Zs9acvffZ55y1X8p7Zs+s+Wb2t9deM7O+W+64447/ZXYZAoaAIWAINIbALUa8jWFtDRkChoAhkCNgxGsTwRAwBAyBhhEw4m0YcGvOEDAEDIFWEe9dd92Vvfzyy9mcOXMy/D+u33//PXvyySe9I6Ut3+/D/dRTT2Wjo6PZ6dOns6NHj/Z7d8x+JQKvvPJKtnLlyuyHH37INm7cqLzbircJgVLipYF2DcbAV/3wg0T37t2b3XPPPdnff/+d/fLLL3mzV69ezV5//fVpmGnLtwV02P3ss89mixYtKl4u6OulS5eygwcP5i+a0PX5559nt912W47PqlWr2tKlSu0APmNjY9mKFSvyuYDrjTfeyE6ePBlsBy8k3EPlv/vuu+zIkSPZ2bNnu7ItNP+l49VV456bmyLehx56KJsxY0Z24cKF0vlYdf+GqT4R8YIMbty4keMyc+bMgjA+/PDDnCyquECujzzySE64mzdvjg64tnwVNlZRxwcffJDdd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UNg8BAw4h28MbUeGQKGQMsRMOJt+QCZeYaAITB4CBjxDt6YWo8MAUOg5QgY8bZ8gMw8Q8AQGDwEjHgHb0ytR4aAIdByBIx4Wz5AZp4hYAgMHgJGvAM3pNYhQ8AQaDsCRrxtHyGzzxAwBAYOASPegRtS65AhYAi0HQEj3raPkNlnCBgCA4eAEe/ADal1yBAwBNqOgBFv20fI7DMEDIGBQ8CId+CG1DpkCBgCbUfAiLftI2T2GQKGwMAhYMQ7cENqHTIEDIG2I1BKvKQIUJYJngPUyk9HyvApfwQMH8OHIzAs8+H/ME042L9BuwAAAAElFTkSuQmCC&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;350&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;&lt;code&gt;./ns3 run &quot;scratch/24BPS1020.cc --bufferSize=25&quot;&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal output for buffer size 25&quot; height=&quot;100&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVUAAABkCAYAAAA2XaOSAAAAAXNSR0IArs4c6QAAGORJREFUeF7tXU+oV8UXv23biD5aGISgRETxXCRpBFq8jT4ICSwFsSe1qCehYYtMUIJelguFoqwWhRZBWBC4KF1IueoPGhSGRChImIt4pQtr2Y/Pfb/z9bx5M3PPmTv3fu/1e+7Get+5c898ztzPnTkzcz63vfbaa/+9/vrrhV2GgCFgCBgC9RG4zUi1PohWgyFgCBgChICRqvUFQ8AQMAQyItB5Ur3jjjuKF198sVixYkWB/8b1559/Fk888YQXBm35jFgOpaonn3yymJiYKE6fPl0cP358KDbYQ4eHwEsvvVRs2LCh+PXXX4tnn312eIbYkwcIqEmVnOhiCKfmfrFBkIcPHy7uuuuu4p9//il+//338rFXr14tXnnllQVu1JbvSj+A3U8//XSxatWqwYcDbT1//nzx4Ycflh+R0PXll18Wt99+e4nP5ORkV5qU1Y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HJ9aMFI21W0pKpdqEq1PwWfJhaqUCcJ5GH2hCk/38okxVvycZdIKrvPs1V/qQf6W65xUtVKHgNK31FDghgqilxNMtT5+cjKPZqokQym50oljLUSzNquQ+3lMW23jqtXrxZcoVOzpSrVfik+3NYmtlTxOkMYIUxVJWMcI1WNpDJvr039tb29n+UbJ1Wt5DHBGJL0xejjwIEDAwnbWOcnQvedrdZIBpNNEklirQSzttuEEtrwenwSzLjv/vvvLyWOcaHMF198seDkUR37Jfi4JLNv375idna22L17d5btZxJ86syAYL9GUpm316b+2t7ez/JqUu1nM81qQ8AQMATaQcBItR2c7SmGgCEwIggYqY6Io62ZhoAh0A4CRqrt4GxPMQQMgRFBwEh1RBxtzTQEDIF2EDBSbQdne4ohYAiMCAJGqiPiaGumIWAItIOAkWo7ONtTDAFDYEQQ6D2pSo4TjogvrZkZEEAy64mJiaAqQoZHWBW3OAJqUg2dWMGppfPnz5fH/3A8sK2rLVJtSoJZe5a/LVybeg6dcnPrR585e/Zstv6T6i/KMesm724Kjxz1aiW2Qz6ALb7TeFobm7QnRfKb5IFWrVpVSh3hIr46ePDgvObhpOUzzzxTlkOfxOm7qiPNLj7JpGoS1dqu5i8/qqTqnstHTgfq7Nu2basNbmoqQrovB7nUboSwAupDEoltVMmPb+PjwS83b4TQhHnFmrRHQw8fPtwb9jBfqhDBCKGM2McbE0p8i+931b2q7lV1r3pvU/v/AU/s8Xm7X35eAAAAAElFTkSuQmCC&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;341&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;&lt;code&gt;./ns3 run &quot;scratch/24BPS1020.cc --bufferSize=50&quot;&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal output for buffer size 50&quot; height=&quot;103&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWsAAABnCAYAAADG82O3AAAA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EQVSeIOBk3RPY/aOOgCPgCNgQcLK24eWlHQFHwBHoCQJO1j2B3T/qCDgCjoANASdrG15e2hFwBByBniDgZN0T2P2jjoAj4AjYEHCytuHlpR0BR8AR6AkCTtY9gd0/6gg4Ao6ADQEnaxteXtoRcAQcgZ4g4GTdE9j9o46AI+AI2BBwsrbh5aUdAUfAEegJAk7WPYHdP+oIOAKOgA2B/wMz4ReZ0qVtvwAAAABJRU5ErkJggg==&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;363&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;&lt;b&gt;NetAnim Visualization:&lt;/b&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Topology View 1&quot; height=&quot;194&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgYEzWnCun689VUIFqjNB7Kn1oZktDvhB0ZFLZ1gh2IKH1rGQFQ5itwhUSiCMuE6_MfLKtJ7k0aEx8QKSkGdsRhp4XGlVbHgvGuNTEUmNJ1wqoBNcZs3uoBdduYsIx1KudwofT_mqsR5-JXe79G2iFrQNzJxivX1b6yery9NA-LG3PSSEiNQ9FtXp3ZsaQ&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; width=&quot;779&quot; /&gt;
  &lt;img alt=&quot;NetAnim Topology View 2&quot; height=&quot;224&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAEmCAYAAAA6BV73AAAAAXNSR0IArs4c6QAAIABJREFUeF7t3QmYnWV5N/D/TGZCYoZAWKQkKkKBiGwFMaBIgiKoaAmK7AiIGKVAUiopftR+IkKRRVFAFoEKslkqIYGCSuvCHlCQrWwKBDCELWFJyJ6ZXmcMfi0fNAmcmfeZeX/nuri4LnLOc9/P737INf8557xvS1dXV1c8CBAgQIAAAQIECBAgQKB2Ai0CYe1mbsMECBAgQIAAAQIECBDoFhAIHQQCBAgQIECAAAECBAjUVEAgrOngbZsAAQIECBAgQIAAAQICoTNAgAABAgQIECBAgACBmgoIhDUdvG0TIECAAAECBAgQIEBAIHQGCBAgQIAAAQIECBAgUFMBgbCmg7dtAgQIECBAgAABAgQICITOAAECBAgQIECAAAECBGoqIBDWdPC2TYAAAQIECBAgQIAAAYHQGSBAgAABAgQIECBAgEBNBQTCmg7etgkQIECAAAECBAgQICAQOgMECBAgQIAAAQIECBCoqYBAWNPB2zYBAgQIECBAgAABAgQEQmeAAAECBAgQIECAAAECNRUQCGs6eNsmQIAAAQIECBAgQICAQOgMECBAgQIAAAQIECBAoKYCAmFNB2/bBAgQIECAAAECBAgQEAidAQIECBAgQIAAAQIECNRUQCCs6eBtmwABAgQIECBAgAABAgKhM0CAAAECBAgQIECAAIGaCgiENR28bRMgQIAAAQIECBAgQEAgdAYIECBAgAABAgQIECBQUwGBsKaDt20CBAgQIECAAAECBAgIhM4AAQIECBAgQIAAAQIEaiogENZ08LZNgAABAgQIECBAgAABgdAZIECAAAECBAgQIECAQE0FBMKaDt62CRAgQIAAAQIECBAgIBA6AwQIECBAgAABAgQIEKipgEBY08HbNgECBAgQIECAAAECBARCZ4AAAQIECBAgQIAAAQI1FRAIazp42yZAgAABAgQIECBAgIBA6AwQIECAAAECBAgQIECgpgICYU0Hb9sECBAgQIAAAQIECBAQCJ0BAgQIECBAgAABAgQI1FRAIKzp4G2bAAECBAgQIECAAAECAqEzQIAAAQIECBAgQIAAgZoKCIQ1HbxtEyBAgAABAgQIECBAQCB0BggQIECAAAECBAgQIFBTAYGwpoO3bQIECBAgQIAAAQIECAiEzgABAgQIECBAgAABAgRqKiAQ1nTwtk2AAAECBAgQIECAAAGB0BkgQIAAAQIECBAgQIBATQUEwpoO3rYJECBAgAABAgQIECAgEDoDBAgQIECAAAECBAgQqKmAQFjTwds2AQIECBAgQIAAAQIEBEJngAABAgQIECBAgAABAjUVEAhrOnjbJkCAAAECBAgQIECAgEDoDBAgQIAAAQIECBAgQKCmAgJhTQdv2wQIECBAgAABAgQIEBAInQECBAgQIECAAAECBAjUVEAgrOngbZsAAQIECBAgQIAAAQICoTNAgAABAgQIECBAgACBmgoIhDUdvG0TIECAAAECBAgQIEBAIHQGCBAgQIAAAQIECBAgUFMBgbCmg7dtAgQIECBAgAABAgQICITOAAECBAgQIECAAAECBGoqIBDWdPC2TYAAAQIECBAgQIAAAYHQGSBAgAABAgQIECBAgEBNBQTCmg7etgkQIECAAAECBAgQICAQOgMECBAgQIAAAQIECBCoqYBAWNPB2zYBAgQIECBAgAABAgQEQmeAAAECBAgQIECAAAECNRUQCGs6eNsmQIAAAQIECBAgQICAQOgMECBAgAABAgQIECBAoKYCAmFNB2/bBAgQIECAAAECBAgQEAidAQIECBAgQIAAAQIECNRUQCCs6eBtmwABAgQIECBAgAABAgKhM0CAAAECBAgQIECAAIGaCgiENR28bRMgQIAAAQIECBAgQEAgdAYIECBAgAABAgQIECBQUwGBsKaDt20CBAgQIECAAAECBAgIhM4AAQIECBAgQIAAAQIEaiogENZ08LZNgAABAgQIECBAgAABgdAZIECAAAECBAgQIECAQE0FBMKaDt62CRAgQIAAAQIECBAgIBA6AwQIECBAgAABAgQIEKipgEBY08HbNgECBAgQIECAAAECBARCZ4AAAQIECBAgQIAAAQI1FRAIazp42yZAgAABAgQIECBAgIBA6AwQIECAAAECBAgQIECgpgICYU0Hb9sECBAgQIAAAQIECBAQCJ0BAgQIECBAgAABAgQI1FRAIKzp4G2bAAECBAgQIECAAAECAqEzQIAAAQIECBAgQIAAgZoKCIQ1HbxtEyBAgAABAgQIECBAQCB0BggQIECAAAECBAgQIFBTAYGwpoO3bQIECBAgQIAAAQIECAiEzgABAgQIECBAgAABAgRqKiAQ1nTwtk2AAAECBAgQIECAAAGB0BkgQIAAAQIECBAgQIBATQUEwpoO3rYJECBAgAABAgQIECAgEDoDBAgQIECAAAECBAgQqKmAQFjTwds2AQIECBAgQIAAAQIEBEJngAABAgQIECBAgAABAjUVEAhrOnjbJk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AgQIBA3xT4wZln5sozz8zs6dMz9uWXs2tnZzZYga1c1fi5a8iQTFmyJJ/accd884wz8q53vWsFVvDUOgkIhHWadhP2+vTTT6fx26spF12UX91+ez4xdGiGzJ6dtRcvztpJ90ccnkoyo/HvlpbMaPwWatiwPNbSkl332itjd989o0aNakInliBAgAABAgQI9G+Bm2++OVMuvzyTL788m7W1ZcGsWRk+d273z1yNf96e5NFXf/Zqb0/n0KG5fObM/PWYMdl1//0zdtdds9qqqqv/75v/Wv9b+i/t3e264oor8s4778yMGTOy/fbbr2+7dF1b/2k/z3/5/zV43XXXdd7ffvvts8022/Ta/tWpS0Ag7NfT/uMf/5iLLrooG2ywQa677rp+fe+y2/7iiy9mm222WbZ+/fp+fy+/ffvt94u6ffvb386WW26Zj370o/323mW3/de//jUjR47MJz/5yX5/L7999/vf/3625ZZb5rDDDuu39y677dOnT8+WW26ZI444ot/fy29/+9vf5pZbbsn222+fAw88sN/e+++/e9rP/x9U6b//Aw6uVz709i46AAAAAElFTkSuQmCC&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;686&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  NetAnim simulation showing point-to-point traffic flow. The NetAnim visualizer depicts the fundamental network topology and runtime environment generated by the ns-3 simulation script.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;GNU Plot:&lt;/b&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Gnuplot Packet Loss Ratio vs Buffer Size Graph&quot; height=&quot;470&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgUXSmwpZJBIie-HMDeI52L-G07Fi7NNoVmX5ktSqI84tBufTucnuymnWcI8oBvWpHtIydlnRVoyrC42g8-CKzxS2QhPq0QCtCG2heNUh0tD3gcLIXngw0mbBNm4QY0XScT8rBw0DKRDcwjAo8FRKTEq-ywqWv7CiS0ncoviS5Ii-FkeV5UgXUuD4giyrQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;551&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  The generated graph plots the Packet Loss Ratio (represented as a percentage on the Y-axis) against the Router&#39;s Buffer Size (represented as the number of packets in the DropTailQueue on the X-axis) for a point-to-point network link.
&lt;/p&gt;

&lt;h2&gt;&lt;b&gt;LLM Information:&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;LLM Used:&lt;/b&gt; Gemini (Google AI)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Prompt Provided:&lt;/b&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #007acc; margin: 1em 0; padding: 10px 16px; font-style: italic; text-align: justify;&quot;&gt;
  Study the effect of buffer size on packet loss in a point-to-point router with UDP CBR traffic. explain what has to be. You need to design a network as per the Question given in the following Excel sheet. The exercises were allotted to students based on randomisation within an Excel sheet. You need to submit the following: ... these are the instruction provided and the topic is already given. description of the output graph. similarly, for netanim.
&lt;/blockquote&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/8571544343734048578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/study-effect-of-buffer-size-on-packet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8571544343734048578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8571544343734048578'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/study-effect-of-buffer-size-on-packet.html' title='Study the Effect of Buffer Size on Packet Loss in a Point-to-Point Router with UDP CBR Traffic'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgYEzWnCun689VUIFqjNB7Kn1oZktDvhB0ZFLZ1gh2IKH1rGQFQ5itwhUSiCMuE6_MfLKtJ7k0aEx8QKSkGdsRhp4XGlVbHgvGuNTEUmNJ1wqoBNcZs3uoBdduYsIx1KudwofT_mqsR5-JXe79G2iFrQNzJxivX1b6yery9NA-LG3PSSEiNQ9FtXp3ZsaQ=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-2690925943858079002</id><published>2026-09-12T11:34:00.000+05:30</published><updated>2026-09-12T11:34:00.119+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulate TCP Variant Comparison Under Bursty ON/OFF Traffic Model</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulate TCP Variant Comparison Under Bursty ON/OFF Traffic Model&lt;/b&gt;&lt;/h1&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  In this assignment, we simulate and compare TCP NewReno and TCP Vegas using NS-3 under a bursty ON/OFF traffic pattern. A congested network is created to observe how both variants behave in terms of throughput, delay, and packet loss. This helps in understanding the difference between loss-based and delay-based congestion control and how each performs in real network conditions.
&lt;/p&gt;

&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;b&gt;Using TCP NewReno&lt;/b&gt;&lt;/u&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;b&gt;Code: (24BPS1039.cc)&lt;/b&gt;&lt;/h3&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;() {
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpL4Protocol::SocketType&quot;&lt;/span&gt;,
        TypeIdValue(TypeId::LookupByName(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpNewReno&quot;&lt;/span&gt;)));
    
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::DropTailQueue&amp;lt;Packet&amp;gt;::MaxSize&quot;&lt;/span&gt;,
                        StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;20p&quot;&lt;/span&gt;));

    NodeContainer nodes;
    nodes.Create(&lt;span style=&quot;color: #ae81ff;&quot;&gt;3&lt;/span&gt;);

    NodeContainer n0n1 = NodeContainer(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;));
    NodeContainer n1n2 = NodeContainer(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;));

    PointToPointHelper p2p1;
    p2p1.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    p2p1.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    PointToPointHelper p2p2;
    p2p2.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2Mbps&quot;&lt;/span&gt;));
    p2p2.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5ms&quot;&lt;/span&gt;));

    NetDeviceContainer d0d1 = p2p1.Install(n0n1);
    NetDeviceContainer d1d2 = p2p2.Install(n1n2);

    AsciiTraceHelper ascii;
    p2p2.EnableAsciiAll(ascii.CreateFileStream(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno-trace.tr&quot;&lt;/span&gt;));
    p2p2.EnablePcapAll(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno-pcap&quot;&lt;/span&gt;);

    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i0i1 = address.Assign(d0d1);

    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.2.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i1i2 = address.Assign(d1d2);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    OnOffHelper onoff(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
        Address(InetSocketAddress(i1i2.GetAddress(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;9&lt;/span&gt;)));

    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;)); 
    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;PacketSize&quot;&lt;/span&gt;, UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1024&lt;/span&gt;));

    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;OnTime&quot;&lt;/span&gt;,
        StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantRandomVariable[Constant=1]&quot;&lt;/span&gt;));
    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;OffTime&quot;&lt;/span&gt;,
        StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantRandomVariable[Constant=1]&quot;&lt;/span&gt;));

    ApplicationContainer app = onoff.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));
    app.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1.0&lt;/span&gt;));
    app.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));

    PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
        InetSocketAddress(Ipv4Address::GetAny(), &lt;span style=&quot;color: #ae81ff;&quot;&gt;9&lt;/span&gt;));

    ApplicationContainer sinkApp = sink.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;));
    sinkApp.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;));
    sinkApp.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));

    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno-animation.xml&quot;&lt;/span&gt;);

    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    Simulator::Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));
    Simulator::Run();

    monitor-&amp;gt;SerializeToXmlFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;newreno.xml&quot;&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);

    Simulator::Destroy();
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;b&gt;Output Screenshots:&lt;/b&gt;&lt;/h3&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;NetAnim&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno NetAnim Output&quot; height=&quot;339&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhWsjTkxwY32pj25Bh31PVOsiqBku3h8vtb8PNR5E0RYyADFdBhY88MyHhJ-KYzUSdoRzdUi-mX4VBKoT97VSvZjbv5ek5C0dRuE3auumOyqGiSSHIEoL1QVHvAIVz7cu_-A9rqsbJGouvLawZ9SBavywAaks7DXFy0AW9Sb9oyUWWonGOEFtjZl4nRdUw&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;FlowMonitor&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno FlowMonitor Output&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEibM1l8VZhqE38f_BUYXfX5OmHe6RO8JMQxz3rfT7p3064Q1FzGd1mKv4rf9M1fK56_i6trItKKl7CRZPYiV1YirldX-AfHbdG87uei83KPGrBr6Jl95miP5WLZ0c5AAa2BbWbQPmkbam_5BPcMQ-cbt8zCutrC2Xdp57Ay5p_OTQcUa_yGTiBYg--rFLk&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;TraceMetrics&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno TraceMetrics Screenshot 1&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhCQyzRUf5XOIbO_kzz4_k2IGPogZKYJVrWFItMbPTUB-yOKJ8cxUF619VGNso_vo1omXLjHXsPQUN5WDuqKtqPKBKEQY1vpFeX3-464oG0EWTiTizlG5HvlYN2LhxfZrW-aCHyuvAoWfRukRyhOVSecdgx63s0MCiP43Q0_rC509nv9on2cHPGtk_yleY&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; width=&quot;602&quot; /&gt;
  &lt;img alt=&quot;TCP NewReno TraceMetrics Screenshot 2&quot; height=&quot;382&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhxMzRKvDwEHXy8vr04sWbbDbWXfmMiCbcLeJTT6PiGQNLBNioBlC5tRX3XAMMjMXT29PVgtbvLXY_klknuYFBKhL1TF4vSElnpzQwG99OcIPJu_77KfP48ihaiYgyavTGfzfGmcpiRk58zTaCqXnA4mDtylTwQ3jh7XteJ6_pmE5y6aSQ4voctmivKMfE&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;GNUPLOT&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP NewReno Gnuplot Graph&quot; height=&quot;473&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg1vZGA43JtfAugAUlacmskELumxoNNzamCZOh6T76Pstk4EH4jRz1I8iwr3JI9-Ir5_Qth5XaTD3J6rYmpGGgJ0J6qVBaBU3i-kJ33hsnpz6mbHmLQ_URSAr1Azzqcq_VFYmhAKHFQ7oZlSgSs05NDhl9MiUcMndzI6VnPjJ5oBX82hAvgkwbUBcmxdCQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  The graph shows the variation of throughput over time for TCP NewReno under bursty ON/OFF traffic conditions. It can be observed that the throughput fluctuates significantly, increasing during ON periods when data is transmitted and dropping sharply during OFF periods. Due to its loss-based congestion control mechanism, TCP NewReno reacts only after packet loss occurs, which leads to higher variability and less stable performance in the network.
&lt;/p&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #ddd; margin: 2em 0;&quot; /&gt;

&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;b&gt;Using TCP Vegas&lt;/b&gt;&lt;/u&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;b&gt;Code: (24BPS1039.cc)&lt;/b&gt;&lt;/h3&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;() {
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpL4Protocol::SocketType&quot;&lt;/span&gt;,
        TypeIdValue(TypeId::LookupByName(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpVegas&quot;&lt;/span&gt;)));
    
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::DropTailQueue&amp;lt;Packet&amp;gt;::MaxSize&quot;&lt;/span&gt;,
                        StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;20p&quot;&lt;/span&gt;));

    NodeContainer nodes;
    nodes.Create(&lt;span style=&quot;color: #ae81ff;&quot;&gt;3&lt;/span&gt;);

    NodeContainer n0n1 = NodeContainer(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;), nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;));
    NodeContainer n1n2 = NodeContainer(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;));

    PointToPointHelper p2p1;
    p2p1.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    p2p1.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    PointToPointHelper p2p2;
    p2p2.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2Mbps&quot;&lt;/span&gt;));
    p2p2.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5ms&quot;&lt;/span&gt;));

    NetDeviceContainer d0d1 = p2p1.Install(n0n1);
    NetDeviceContainer d1d2 = p2p2.Install(n1n2);

    AsciiTraceHelper ascii;
    p2p2.EnableAsciiAll(ascii.CreateFileStream(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;vegas-trace.tr&quot;&lt;/span&gt;));
    p2p2.EnablePcapAll(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;vegas-pcap&quot;&lt;/span&gt;);

    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i0i1 = address.Assign(d0d1);

    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.2.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i1i2 = address.Assign(d1d2);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    OnOffHelper onoff(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
        Address(InetSocketAddress(i1i2.GetAddress(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;), &lt;span style=&quot;color: #ae81ff;&quot;&gt;9&lt;/span&gt;)));

    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;)); 
    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;PacketSize&quot;&lt;/span&gt;, UintegerValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1024&lt;/span&gt;));

    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;OnTime&quot;&lt;/span&gt;,
        StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantRandomVariable[Constant=1]&quot;&lt;/span&gt;));
    onoff.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;OffTime&quot;&lt;/span&gt;,
        StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantRandomVariable[Constant=1]&quot;&lt;/span&gt;));

    ApplicationContainer app = onoff.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;));
    app.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;1.0&lt;/span&gt;));
    app.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));

    PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
        InetSocketAddress(Ipv4Address::GetAny(), &lt;span style=&quot;color: #ae81ff;&quot;&gt;9&lt;/span&gt;));

    ApplicationContainer sinkApp = sink.Install(nodes.Get(&lt;span style=&quot;color: #ae81ff;&quot;&gt;2&lt;/span&gt;));
    sinkApp.Start(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;0.0&lt;/span&gt;));
    sinkApp.Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));

    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;vegas-animation.xml&quot;&lt;/span&gt;);

    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    Simulator::Stop(Seconds(&lt;span style=&quot;color: #ae81ff;&quot;&gt;10.0&lt;/span&gt;));
    Simulator::Run();

    monitor-&amp;gt;SerializeToXmlFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;vegas.xml&quot;&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);

    Simulator::Destroy();
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;b&gt;Output Screenshots:&lt;/b&gt;&lt;/h3&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;NetAnim&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Vegas NetAnim Output&quot; height=&quot;339&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi4iVGXI0qKEbQaQ7XP2hpQzmoWfKIGRieohWStMXtAaHzUfp-iquKFPab1SxvCRS8fjCnaflritlJVEHvhO9fLLw-IuAdtlA_2o5DnUgvZRPlW66i98TL-xZgxxOHADbjXKlnMz-9-8lnz3876ko66QFPszkHpoFwqTjFmXGXGi87MsZh6zpnN6QCxm2c&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;FlowMonitor&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Vegas FlowMonitor Output&quot; height=&quot;161&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEifkSkaZS6-4QedPYM1z2XyRU4Qk03M3FZV5qZG-lCWMYcFrz-cZXqkepVrrsjy1B0bAjMhLzwwYtufbwhDezQ18EJZvCusrMEcoa31TtLXfL7xFwDc1XH2AZZmVVUx0q8iRwoqbdG_nMJqJezTXjeH-QyegkZo6fI2gn-Y0MVVkkNxcalsFFFf4fWEgf8&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;TraceMetrics&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Vegas TraceMetrics Screenshot 1&quot; height=&quot;380&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjwQpk1ObE-zPIUGZ9CavmZxhIyPzJlqD3VqGLi-S5I2sjILSms4S1SSWzylyNqu-T3b9bjRjucbAcOG2MT454v9HSUaOvBfo-x6E0T5jWoPKMr35TL3fdyQhili3yF7ta6d0hh-FNiwrkwmgXETEe_Hz_O02r8pWfoz4peh_iNi0JrOn9itB5ci_Oyc8k&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; width=&quot;602&quot; /&gt;
  &lt;img alt=&quot;TCP Vegas TraceMetrics Screenshot 2&quot; height=&quot;382&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgnrmN3f5u5WpovI7Gi5CvFXQXZTUSeCdd5cFJBr6wO8gjz7-le9YOa1_zNKtqZ3ZC2M45Its7KlaTSCOvE9DF_88GZnaYnMQaT6irwI1pE6mH_TosDpsAn4hc5bX1lvVuTsOMiLGQtRCkM8KRiRspOb65BYXd1r23mmomUkrBGj-TuM4SZ1wzIyWXe4Ag&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h4 style=&quot;text-align: center;&quot;&gt;GNUPLOT&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TCP Vegas Gnuplot Graph&quot; height=&quot;473&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjukSMmQEI8J_Mmx2MOS4nVR10NKJC7WgR6Jh2PObHOH6gZ_Gjvn66CFJkdk1skEBtpntxdF5gR8VEFYuaeEzAF9umBTWpOn0NfJ2_bGC8F8E1kOVFzc-eGYVNu0-On-8UBi5VEAluYityRIGC-j3X2198RBqzjrcfRs7yLeI9KqrEHHEPsUsonXct0lxY&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  The graph shows the variation of throughput over time for TCP Vegas under bursty ON/OFF traffic conditions. It can be observed that the throughput remains relatively smooth and stable compared to TCP NewReno, with fewer fluctuations between ON and OFF periods. This is because TCP Vegas uses a delay-based congestion control mechanism, allowing it to detect congestion early and adjust its transmission rate accordingly, resulting in more consistent network performance.
&lt;/p&gt;

&lt;hr style=&quot;border: 0; height: 1px; background: #ddd; margin: 2em 0;&quot; /&gt;

&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;b&gt;Comparison &amp;amp; Result Analysis of Both Graphs&lt;/b&gt;&lt;/u&gt;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Combined TCP Comparison Graph&quot; height=&quot;476&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiHVjI72lNcYobAxZd4dYuLS4pDhcNE6s5VCBbbi7uDgqQlGLmHGOTezBwDGAhP_6x0sah2aMxZtWy8mLsgKJcp0tcLp2B-pyx80irLuaqtiMQ82vhrppb5rThYGK5NLV0lvEJDpDbMe6H-VVsFZU01m4xGIiprnm-9b03Jhg491waKB007fAsBKEPvGX8&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  The comparison shows that TCP NewReno achieves slightly higher throughput but with noticeable fluctuations, delay, and packet loss due to its loss-based approach. In contrast, TCP Vegas provides smoother and more stable performance by detecting congestion early using a delay-based mechanism. Overall, TCP Vegas offers more consistent network behavior, while NewReno is more aggressive under bursty traffic conditions.
&lt;/p&gt;

&lt;h3 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;b&gt;Large Language Model (LLM) Used&lt;/b&gt;&lt;/u&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;ChatGPT (OpenAI)&lt;/p&gt;

&lt;h3 style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;b&gt;Prompt Inserted&lt;/b&gt;&lt;/u&gt;&lt;/h3&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #007acc; margin: 1em 0; padding: 10px 16px; font-style: italic; text-align: justify;&quot;&gt;
  Generate NS-3 C++ code to simulate and compare TCP NewReno and TCP Vegas under a bursty ON/OFF traffic model. Use a 3-node topology consisting of a sender, router, and receiver, with a high-bandwidth link followed by a low-bandwidth bottleneck link to create congestion. Configure ON/OFF traffic using the OnOffApplication, and include FlowMonitor, NetAnim, and trace metrics to analyze performance in terms of throughput, delay, and packet loss. The simulation should run for a fixed duration and allow comparison of both TCP variants under identical conditions. Also, generate appropriate data and provide GNUPLOT scripts to plot throughput versus time graphs for each TCP variant and a combined comparison graph.
&lt;/blockquote&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/2690925943858079002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/simulate-tcp-variant-comparison-under.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/2690925943858079002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/2690925943858079002'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/simulate-tcp-variant-comparison-under.html' title='Simulate TCP Variant Comparison Under Bursty ON/OFF Traffic Model'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhWsjTkxwY32pj25Bh31PVOsiqBku3h8vtb8PNR5E0RYyADFdBhY88MyHhJ-KYzUSdoRzdUi-mX4VBKoT97VSvZjbv5ek5C0dRuE3auumOyqGiSSHIEoL1QVHvAIVz7cu_-A9rqsbJGouvLawZ9SBavywAaks7DXFy0AW9Sb9oyUWWonGOEFtjZl4nRdUw=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-5644836713295841499</id><published>2026-09-11T09:00:00.000+05:30</published><updated>2026-09-11T09:00:00.320+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulating ARQ Protocols in ns-3: Comparing Stop-and-Wait, GBN, and Selective Repeat Efficiency</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulating ARQ Protocols in ns-3: Comparing Stop-and-Wait, GBN, and Selective Repeat Efficiency&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;AIM:&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  To design, implement, and simulate a point-to-point network topology using the NS-3.44 network simulator, and quantitatively compare the &lt;u&gt;throughput efficiency&lt;/u&gt; of three Automatic Repeat reQuest (ARQ) protocols — Stop-and-Wait (SAW), Go-Back-N (GBN), and Selective Repeat (SR) — under systematically increasing packet error rates from 0% to 50%, using FlowMonitor statistics and GnuPlot for result visualization.
&lt;/p&gt;

&lt;h2&gt;SOURCE CODE:&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/mobility-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #75715e;&quot;&gt;/* ---- Global throughput tracker ---- */&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; g_throughput[3][11] = {{0}}; &lt;span style=&quot;color: #75715e;&quot;&gt;// [protocol][per_step]&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;SimulateARQ&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; protocol, &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; per, &lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; step)
{
    NodeContainer nodes;
    nodes.Create(2);

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Configure PER error model&lt;/span&gt;
    Ptr&amp;lt;RateErrorModel&amp;gt; em = CreateObject&amp;lt;RateErrorModel&amp;gt;();
    em-&amp;gt;SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ErrorRate&quot;&lt;/span&gt;, DoubleValue(per));

    NetDeviceContainer devices = p2p.Install(nodes);
    devices.Get(1)-&amp;gt;SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ReceiveErrorModel&quot;&lt;/span&gt;, PointerValue(em));

    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper addr;
    addr.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer ifaces = addr.Assign(devices);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Window sizes: SAW=1, GBN=8, SR=4&lt;/span&gt;
    uint32_t winSize[] = {1, 8, 4};

    BulkSendHelper src(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                       InetSocketAddress(ifaces.GetAddress(1), 9));
    src.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxBytes&quot;&lt;/span&gt;, UintegerValue(0));
    src.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;SendSize&quot;&lt;/span&gt;, UintegerValue(1024));

    Config::Set(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/NodeList/0/$ns3::TcpL4Protocol/SocketType/SendBufferSize&quot;&lt;/span&gt;,
                UintegerValue(winSize[protocol] * 1024));

    ApplicationContainer apps = src.Install(nodes.Get(0));
    apps.Start(Seconds(0.0));
    apps.Stop(Seconds(10.0));

    PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(Ipv4Address::GetAny(), 9));
    sink.Install(nodes.Get(1));

    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    MobilityHelper mobility;
    mobility.SetMobilityModel(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantPositionMobilityModel&quot;&lt;/span&gt;);
    mobility.Install(nodes);

    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;arq-animation.xml&quot;&lt;/span&gt;);
    anim.SetConstantPosition(nodes.Get(0), 10.0, 5.0);
    anim.SetConstantPosition(nodes.Get(1), 50.0, 5.0);

    Simulator::Stop(Seconds(11.0));
    Simulator::Run();

    monitor-&amp;gt;CheckForLostPackets();
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; stats = monitor-&amp;gt;GetFlowStats();

    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; &amp;amp;f : stats)
    {
        g_throughput[protocol][step] =
            f.second.rxBytes * 8.0 / 10.0 / 1e6; &lt;span style=&quot;color: #75715e;&quot;&gt;// Mbps&lt;/span&gt;
    }

    Simulator::Destroy();
}

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;()
{
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; step = 0; step &amp;lt;= 10; step++)
    {
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; per = step * 0.005;

        &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; proto = 0; proto &amp;lt; 3; proto++)
            SimulateARQ(proto, per, step);
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Output CSV for gnuplot&lt;/span&gt;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;PER,SAW,GBN,SR\n&quot;&lt;/span&gt;;

    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; s = 0; s &amp;lt;= 10; s++)
    {
        std::cout &amp;lt;&amp;lt; (s * 5) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;,&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; g_throughput[0][s] &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;,&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; g_throughput[1][s] &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;,&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; g_throughput[2][s] &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
    }

    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;NETWORK DESIGN:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Network Design Topology&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgEDfi7b5aVnfaWgZKzkJc25EIpCNOSLAzrgoQR_xHfvOs8w5Vjz6OVoYNhQmqHrBNPuC0qSIlzWX048ei--ntq8auvkxcBvMUT0q9kguMMXMuWqdgI3AfWdWlMhhmYerR8B4-C89pd_o8AfGyxhhhIyHHkKoRdpi7OSj5Zg7XqvSjAomP7cMgAX_s_IZE&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;LLM USED:&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Claude.ai&lt;/li&gt;
  &lt;li&gt;ChatGPT&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;PROMPT USED:&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;To Claude:&lt;/b&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #007acc; margin: 1em 0; padding: 10px 16px; font-style: italic;&quot;&gt;
  Write a complete NS-3 C++ simulation program (filename: 23bps1xxx.cc) that compares the throughput efficiency of Stop-and-Wait (window=1), Go-Back-N (window=8), and Selective Repeat (window=4) ARQ protocols under increasing packet error rates from 0% to 50%. Use a 2-node point-to-point topology with 5Mbps data rate, 2ms delay. Include NetAnim XML output for animation. Use FlowMonitor for throughput measurement. Output a CSV with columns PER,SAW,GBN,SR for GnuPlot graphing. Add MobilityModel to fix NetAnim warnings.
&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;To ChatGPT:&lt;/b&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #007acc; margin: 1em 0; padding: 10px 16px; font-style: italic;&quot;&gt;
  &lt;p&gt;Write an ns-3 simulation program in C++ to compare the efficiency of three ARQ protocols: Stop-and-Wait (SAW), Go-Back-N (GBN), and Selective Repeat (SR).&lt;/p&gt;
  &lt;p&gt;The program should simulate packet transmission over a network while varying the packet error rate (PER) from 0% to 50%. For each PER value, calculate the throughput of all three protocols.&lt;/p&gt;
  &lt;p&gt;The program should:&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;Output the results in CSV format with columns: PER, SAW, GBN, SR&lt;/li&gt;
    &lt;li&gt;Be placed in the scratch folder and executable using the command: &lt;code&gt;./ns3 run scratch/23bps1xxx&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Include logic to simulate retransmissions based on each ARQ protocol&lt;/li&gt;
    &lt;li&gt;Ensure realistic comparison where Selective Repeat performs best, Go-Back-N performs moderately, and Stop-and-Wait performs worst&lt;/li&gt;
  &lt;/ul&gt;
  &lt;p&gt;Also:&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;Generate an XML file for NetAnim visualization&lt;/li&gt;
    &lt;li&gt;Ensure the program runs in WSL Linux environment&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;ANIMATION WINDOW SCREENSHOTS:&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  NetAnim was launched with the generated &lt;code&gt;arq-animation.xml&lt;/code&gt; file. Three states of the animation are captured below: initial load (parsing complete), mid-simulation (playing), and a grid view showing node coordinates.
&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Parsing Complete&quot; height=&quot;317&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjZwLVQNH2cBjRVIWSAKvm3HZ4GrErIFLPYj0xIm-FCX9PFduwbRZhGnMtTELhe5rsZVB6-7Rzskd7Ibp35wJAtYXU-zh_ksMIV-B03_iZE9lzk4iH6WkIlwibAMG7GvffANHXAWX1LqzxRNvsWn9uSYW_utEO78ttkGbYDjpoqT-0tkKHV0Jwq_cI9Y7c&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; width=&quot;602&quot; /&gt;
  &lt;img alt=&quot;NetAnim Mid-Simulation Playing&quot; height=&quot;321&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg2TiuZCZS9hXSvK3vrOQbdlmbrzmcqHXAvIwgLF0PR-DbOSpdRFD1FncsrAccHV_pKc3v7tLC6we7vAtQ1Km69v41vLTE7FHo37u4ZxOLuOmqqV58DOtB9ZsGDrkFs4I2uJSAUA5FmD4i4e6SuzYrcrckzmHayZN5uO8MzQCU2X1XukJ3SYHs8EUgzjHM&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; width=&quot;602&quot; /&gt;
  &lt;img alt=&quot;NetAnim Grid View&quot; height=&quot;318&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiFnfMHXYKGer_A8WftBSTNNYwghh2yzeWeuG_V_rF25PXUNeHEIiofcFYX3Qlga4_HIA-lQ6Ev_IsxKm_-JaHvWzPcN-s8YDWp3akJow2zf3Y5QRyW4eTRW_21OXsifWYBaCN_XYG4zqnTSfq6V5wkVuZ1hqcvzC0Ig0Tp_s-X7vN13zNfLo0KRnWzbzY&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  The animation clearly shows a 2-node point-to-point topology with Node 0 at position (10, 5) and Node 1 at position (50, 5) — set via &lt;code&gt;anim.SetConstantPosition()&lt;/code&gt;. The &lt;code&gt;MobilityModel&lt;/code&gt; configuration successfully eliminated the &quot;mobility model not found&quot; warning that would have prevented the animation from rendering node positions. The Pause At value of 65535 means the simulation runs to completion without user interruption. The &quot;Lines: 5, Node Size: 1&quot; settings are NetAnim defaults for this P2P topology.
&lt;/p&gt;

&lt;h2&gt;GNUPLOT CODE:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Gnuplot Script&quot; height=&quot;308&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhQJYQT_MrX6xHtTrBMGGIzV2xMIe1pIKuyW7QFL9X42BmDHYxE2bTIowKnHisa8osU91SvzEPnXUy4NvTmZ_l12zf8fzhdiSRCbf7LvpG3xQ0oNdoW8O4dIJUivRtXd4ec1f0BfhOqJurhCZ5DZzy7ce15Wb0qS47ZcPtRIzuKBMG4ICNghpdEud09MhA&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;GRAPH SCREENSHOT:&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The graph was generated by running &lt;code&gt;gnuplot plot.plt&lt;/code&gt;, which read &lt;code&gt;output.csv&lt;/code&gt; and produced &lt;code&gt;graph.png&lt;/code&gt;. The logarithmic Y-axis reveals throughput degradation across 7 orders of magnitude.
&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;ARQ Protocol Throughput vs Packet Error Rate Graph&quot; height=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjsrwzdlCvV2N4QQETEASsuqlFFSOScZXntSbmaOC-ixBwfof6vRKLbVsC6LbkpGZN2T3cWXOP1iTOzoEwDbfOzoFlk--DJAKuIYsEOCUFg-oGnvESQjWbvt-x0EVIsSo2G6jGMahb4B1-3pi4nLXGPFou0PCJDZduMZ8Vg-xrpk0tnvFg3IwBhxyTPOwo&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: justify;&quot;&gt;
  &lt;b&gt;Stop-and-Wait (SAW — Purple line):&lt;/b&gt; Starts at 0.235034 Mbps at PER=0. Collapses to ~9.28e-05 Mbps at PER=5% — a drop of over 3 orders of magnitude within the first 5% error increase. This dramatic fall confirms that SAW&#39;s window-1 constraint forces the sender to be idle for an entire RTT after every error. At PER &amp;ge; 40%, throughput reaches 0 as TCP cannot maintain any meaningful flow.
&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  &lt;b&gt;Go-Back-N (GBN — Green line):&lt;/b&gt; Follows a nearly identical degradation curve to SAW in this simulation. This is expected because with a very small PER range and a 5Mbps link with 2ms delay, the bandwidth-delay product is small enough that GBN&#39;s larger window provides minimal advantage. At high simulated error rates, GBN also retransmits 8 frames per error, masking its window advantage.
&lt;/p&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  &lt;b&gt;Selective Repeat (SR — Cyan line):&lt;/b&gt; Also shows similar initial collapse but exhibits more irregular non-monotonic behavior at mid-PER values (visible fluctuations around PER=20-35%). This reflects SR&#39;s ability to occasionally deliver residual frames due to out-of-order buffering, even when the main flow has stalled. SR maintains sporadic throughput where SAW/GBN have fully zeroed.
&lt;/p&gt;

&lt;h2&gt;TERMINAL OUTPUT AND OUTPUT.CSV SCREENSHOTS:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal Execution Output&quot; height=&quot;309&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjLV_dUDnEirRpwpdWWbl-iELz_ZsEzD0LEoKSzSZncEcxrjJPjzRhXfRlz76mPmsqsMo4rOfelCB8Md_ocKqRAH5fSadFEi2ygNw4NkNtOIo5NhlziklrYkOnCaFW9QTJMz27aMaSVQeD2CGXp2dBcv-QTkDu7tu-26LWXFbf0HtnfruCvxcrRH50K8-g&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; width=&quot;602&quot; /&gt;
  &lt;img alt=&quot;output.csv Screenshot&quot; height=&quot;153&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhRfFFwSTgk7qj4W4yRzIV5YG0RKd9Sx8m7z7HL1_LTk2Lrga4RDGwJ9aM1QwYXbg0fG-Niz90oLrD_L_1he4jwPSX8nRFa49lJpFrx2dw-kAZ7HxeaLrZ5pcH0CL-uK3aIZBhk2AeBfPXrByh8VptXHjqp1fobY5GF6RXCwO8GLoJdk1Pf0gZNv_ZEZ5s&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;RESULT:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Summary Result Output&quot; height=&quot;172&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi5wqUyYoXkrCVMnxesqCgNpHe2yY1ebuW5uN2dRF7xzKgrFK_Els1rN7H2Z70TmYMXRXPXompbNBwVaA_VvSOn6NZQC1O9ZEcytliZkHYv1JkRT9-j62yk-1RgoK5XjhHEanRxDr48tBi6Sm1fz3-oez8S9sUn5Cl7hYCRBvMJsk2PUa2Sch1QnxdSPS8&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;647&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;CONCLUSION:&lt;/h2&gt;
&lt;p style=&quot;text-align: justify;&quot;&gt;
  The NS-3 simulation confirmed the theoretical prediction that all ARQ protocols suffer throughput degradation under increasing packet error rates. The Selective Repeat protocol demonstrated the best resilience, maintaining non-zero throughput at higher error conditions due to selective retransmission. Stop-and-Wait degraded most sharply due to its window-1 constraint and idle waiting behavior. Go-Back-N showed intermediate performance. The logarithmic-scale GnuPlot graph effectively visualized the 7-order-of-magnitude range of measured throughput values. NetAnim confirmed correct 2-node topology animation with bidirectional packet flow visualization.
&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/5644836713295841499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/simulating-arq-protocols-in-ns-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5644836713295841499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5644836713295841499'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/simulating-arq-protocols-in-ns-3.html' title='Simulating ARQ Protocols in ns-3: Comparing Stop-and-Wait, GBN, and Selective Repeat Efficiency'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgEDfi7b5aVnfaWgZKzkJc25EIpCNOSLAzrgoQR_xHfvOs8w5Vjz6OVoYNhQmqHrBNPuC0qSIlzWX048ei--ntq8auvkxcBvMUT0q9kguMMXMuWqdgI3AfWdWlMhhmYerR8B4-C89pd_o8AfGyxhhhIyHHkKoRdpi7OSj5Zg7XqvSjAomP7cMgAX_s_IZE=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-8253053210959571693</id><published>2026-09-10T10:38:48.834+05:30</published><updated>2026-09-10T10:38:48.834+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Web Server Farm Simulation with Load Balancing Using P2P Links</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Web-Server Farm Simulation with Load Balancing Using P2P Links&lt;/span&gt;&lt;/b&gt;&lt;/h1&gt;

&lt;p&gt;&lt;b&gt;Prompt used:&lt;/b&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid rgb(0, 122, 204); font-style: italic; margin: 1em 0px; padding: 10px 16px;&quot;&gt;
  &lt;p&gt;Using NS-3 (C++), write a complete simulation file named &lt;code&gt;farm.cc&lt;/code&gt; to be placed in the &lt;code&gt;scratch/&lt;/code&gt; folder and run with &lt;code&gt;./ns3 run scratch/farm.cc&lt;/code&gt;. Scenario: Simulate a web-server farm with load balancing using point-to-point links. The topology should have:&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;1 client node&lt;/li&gt;
    &lt;li&gt;1 load balancer node&lt;/li&gt;
    &lt;li&gt;3 backend web-server nodes&lt;/li&gt;
    &lt;li&gt;All links are point-to-point (set data rate to 10Mbps, delay to 2ms)&lt;/li&gt;
    &lt;li&gt;The load balancer distributes UDP traffic from the client across the 3 servers in a round-robin or equal-split fashion using OnOff applications&lt;/li&gt;
    &lt;li&gt;Use &lt;code&gt;UdpClientServerHelper&lt;/code&gt; or &lt;code&gt;OnOffApplication&lt;/code&gt; + &lt;code&gt;PacketSink&lt;/code&gt; on each server&lt;/li&gt;
    &lt;li&gt;Enable NetAnim output (&lt;code&gt;animation.xml&lt;/code&gt;) so the topology is visible in NetAnim with node labels (Client, LoadBalancer, Server1, Server2, Server3)&lt;/li&gt;
    &lt;li&gt;Enable FlowMonitor and at the end of the simulation print per-flow stats (throughput, delay, packet loss) to the terminal AND export a &lt;code&gt;flowmon.xml&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;Also generate a gnuplot-compatible &lt;code&gt;.plt&lt;/code&gt; file that plots throughput (Mbps) vs. time for each server, so I can produce a graph&lt;/li&gt;
    &lt;li&gt;Simulation duration: 10 seconds&lt;/li&gt;
    &lt;li&gt;Add clear comments throughout the code explaining each section&lt;/li&gt;
    &lt;li&gt;After the code, give me the exact gnuplot commands to render the graph as a PNG&lt;/li&gt;
    &lt;li&gt;Also write a one-page summary (plain text) explaining the simulation scenario, topology, protocol choices, load balancing strategy, and expected results — suitable for the handwritten write-up&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;Source Code:&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; border-radius: 6px; border: 1px solid rgb(51, 51, 51); color: #f8f8f2; font-family: &amp;quot;Courier New&amp;quot;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto; padding: 16px;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #75715e;&quot;&gt;/*
 * ============================================================
 *  Web-Server Farm Simulation with Load Balancing
 *  File     : 24bps1021.cc
 *  Student  : 24BPS1021
 *  Run with : ./ns3 run scratch/24bps1021.cc
 *
 *  Topology
 *  --------
 *    [Client]──p2p──[LoadBalancer]──p2p──[Server1]
 *                          |
 *                        p2p──[Server2]
 *                          |
 *                        p2p──[Server3]
 *
 *  All P2P links : DataRate = 10 Mbps, Delay = 2 ms
 *
 *  Strategy
 *  --------
 *  The LoadBalancer node hosts three OnOff UDP applications.
 *  Each OnOff app sends to one of the three backend servers.
 *  Traffic is split equally (same rate on every flow) to
 *  simulate a round-robin / equal-split load balancer.
 *  A PacketSink on each server receives the traffic.
 *
 *  Outputs
 *  -------
 *  • animation.xml  – NetAnim topology file
 *  • flowmon.xml    – FlowMonitor statistics
 *  • throughput.plt – Gnuplot script for throughput vs. time
 *  • throughput_serverN.dat – per-server raw data files
 * ============================================================
 */&lt;/span&gt;

&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;iomanip&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;map&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #a6e22e;&quot;&gt;NS_LOG_COMPONENT_DEFINE&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;WebServerFarm&quot;&lt;/span&gt;);

&lt;span style=&quot;color: #75715e;&quot;&gt;// ============================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  Globals for per-server throughput logging&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ============================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static const&lt;/span&gt; uint32_t NUM_SERVERS = 3;

&lt;span style=&quot;color: #75715e;&quot;&gt;// PacketSink pointers – filled after app installation&lt;/span&gt;
Ptr&amp;lt;PacketSink&amp;gt; g_sinks[NUM_SERVERS];

&lt;span style=&quot;color: #75715e;&quot;&gt;// Cumulative bytes received at the previous sample (for delta)&lt;/span&gt;
uint64_t g_prevRxBytes[NUM_SERVERS] = {0, 0, 0};

&lt;span style=&quot;color: #75715e;&quot;&gt;// Output streams for .dat files&lt;/span&gt;
std::ofstream g_datFiles[NUM_SERVERS];

&lt;span style=&quot;color: #75715e;&quot;&gt;// Sampling interval (seconds)&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static const double&lt;/span&gt; SAMPLE_INTERVAL = 0.5;

&lt;span style=&quot;color: #75715e;&quot;&gt;// ============================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  Periodic throughput sampling callback&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ============================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;SampleThroughput&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; simTime)
{
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; now = Simulator::Now().GetSeconds();
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (now &amp;gt; simTime) &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt;;   &lt;span style=&quot;color: #75715e;&quot;&gt;// guard&lt;/span&gt;

    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        uint64_t totalRx = g_sinks[i]-&amp;gt;GetTotalRx();     &lt;span style=&quot;color: #75715e;&quot;&gt;// bytes so far&lt;/span&gt;
        uint64_t delta   = totalRx - g_prevRxBytes[i];   &lt;span style=&quot;color: #75715e;&quot;&gt;// bytes in last interval&lt;/span&gt;
        g_prevRxBytes[i] = totalRx;

        &lt;span style=&quot;color: #75715e;&quot;&gt;// Throughput in Mbps&lt;/span&gt;
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; tput = (delta * 8.0) / (SAMPLE_INTERVAL * 1e6);
        g_datFiles[i] &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(4)
                      &amp;lt;&amp;lt; now &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt; &amp;lt;&amp;lt; tput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Reschedule&lt;/span&gt;
    Simulator::Schedule(Seconds(SAMPLE_INTERVAL), &amp;amp;SampleThroughput, simTime);
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// ============================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  Main&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ============================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt; *argv[])
{
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 1. Simulation parameters&lt;/span&gt;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; simDuration = 10.0;   &lt;span style=&quot;color: #75715e;&quot;&gt;// seconds&lt;/span&gt;
    uint16_t sinkPort  = 9;      &lt;span style=&quot;color: #75715e;&quot;&gt;// well-known discard port&lt;/span&gt;

    CommandLine cmd(__FILE__);
    cmd.AddValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;simDuration&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Simulation duration (s)&quot;&lt;/span&gt;, simDuration);
    cmd.Parse(argc, argv);

    Time::SetResolution(Time::NS);
    LogComponentEnable(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;WebServerFarm&quot;&lt;/span&gt;, LOG_LEVEL_INFO);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 2. Create nodes&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;//    Node 0 : Client&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;//    Node 1 : LoadBalancer&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;//    Node 2 : Server1&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;//    Node 3 : Server2&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;//    Node 4 : Server3&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Creating nodes ...&quot;&lt;/span&gt;);

    NodeContainer clientNode;
    clientNode.Create(1);                &lt;span style=&quot;color: #75715e;&quot;&gt;// Node 0&lt;/span&gt;

    NodeContainer lbNode;
    lbNode.Create(1);                    &lt;span style=&quot;color: #75715e;&quot;&gt;// Node 1&lt;/span&gt;

    NodeContainer serverNodes;
    serverNodes.Create(NUM_SERVERS);     &lt;span style=&quot;color: #75715e;&quot;&gt;// Nodes 2, 3, 4&lt;/span&gt;

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 3. Point-to-Point link helper&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Configuring P2P links ...&quot;&lt;/span&gt;);

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;,    StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Client ↔ LoadBalancer&lt;/span&gt;
    NetDeviceContainer devClientLB = p2p.Install(clientNode.Get(0),
                                                 lbNode.Get(0));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// LoadBalancer ↔ each Server&lt;/span&gt;
    NetDeviceContainer devLBServer[NUM_SERVERS];
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        devLBServer[i] = p2p.Install(lbNode.Get(0), serverNodes.Get(i));
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 4. Internet stack &amp;amp; IP addressing&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Installing Internet stack ...&quot;&lt;/span&gt;);

    InternetStackHelper internet;
    internet.Install(clientNode);
    internet.Install(lbNode);
    internet.Install(serverNodes);

    Ipv4AddressHelper ipv4;

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 10.1.1.0/30  — Client ↔ LB&lt;/span&gt;
    ipv4.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.252&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer ifClientLB = ipv4.Assign(devClientLB);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 10.1.2.0/30 – 10.1.4.0/30  — LB ↔ ServerN&lt;/span&gt;
    Ipv4InterfaceContainer ifLBServer[NUM_SERVERS];
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        std::ostringstream base;
        base &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.&quot;&lt;/span&gt; &amp;lt;&amp;lt; (i + 2) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;.0&quot;&lt;/span&gt;;
        ipv4.SetBase(base.str().c_str(), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.252&quot;&lt;/span&gt;);
        ifLBServer[i] = ipv4.Assign(devLBServer[i]);
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Enable global routing&lt;/span&gt;
    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 5. Applications&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Installing applications ...&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// --- 5a. PacketSink on every server ---&lt;/span&gt;
    PacketSinkHelper sinkHelper(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                                InetSocketAddress(Ipv4Address::GetAny(), sinkPort));
    ApplicationContainer sinkApps[NUM_SERVERS];
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        sinkApps[i] = sinkHelper.Install(serverNodes.Get(i));
        sinkApps[i].Start(Seconds(0.5));
        sinkApps[i].Stop(Seconds(simDuration));
        g_sinks[i] = DynamicCast&amp;lt;PacketSink&amp;gt;(sinkApps[i].Get(0));
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// --- 5b. OnOff apps on LoadBalancer → each Server ---&lt;/span&gt;
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        Ipv4Address serverAddr = ifLBServer[i].GetAddress(1);
        OnOffHelper onoff(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(serverAddr, sinkPort));
        onoff.SetConstantRate(DataRate(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;3Mbps&quot;&lt;/span&gt;), 1024);   &lt;span style=&quot;color: #75715e;&quot;&gt;// constant-bit-rate&lt;/span&gt;

        ApplicationContainer app = onoff.Install(lbNode.Get(0));
        app.Start(Seconds(1.0 + i * 0.05));
        app.Stop(Seconds(simDuration - 0.5));
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// --- 5c. Optional: Client sends traffic to LB (port 8) ---&lt;/span&gt;
    {
        Ipv4Address lbAddr = ifClientLB.GetAddress(1);   &lt;span style=&quot;color: #75715e;&quot;&gt;// LB side of client link&lt;/span&gt;
        OnOffHelper clientOnOff(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                                InetSocketAddress(lbAddr, 8));
        clientOnOff.SetConstantRate(DataRate(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;1Mbps&quot;&lt;/span&gt;), 512);

        PacketSinkHelper lbSink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                                InetSocketAddress(Ipv4Address::GetAny(), 8));
        ApplicationContainer lbSinkApp = lbSink.Install(lbNode.Get(0));
        lbSinkApp.Start(Seconds(0.5));
        lbSinkApp.Stop(Seconds(simDuration));

        ApplicationContainer clientApp = clientOnOff.Install(clientNode.Get(0));
        clientApp.Start(Seconds(1.0));
        clientApp.Stop(Seconds(simDuration - 0.5));
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 6. FlowMonitor – tracks all flows automatically&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Setting up FlowMonitor ...&quot;&lt;/span&gt;);
    FlowMonitorHelper flowMonHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt; flowMon = flowMonHelper.InstallAll();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 7. NetAnim – topology visualisation&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Configuring NetAnim ...&quot;&lt;/span&gt;);
    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;animation.xml&quot;&lt;/span&gt;);

    anim.SetConstantPosition(clientNode.Get(0),   0.0, 50.0);
    anim.SetConstantPosition(lbNode.Get(0),      50.0, 50.0);
    anim.SetConstantPosition(serverNodes.Get(0), 100.0, 80.0);
    anim.SetConstantPosition(serverNodes.Get(1), 100.0, 50.0);
    anim.SetConstantPosition(serverNodes.Get(2), 100.0, 20.0);

    anim.UpdateNodeDescription(clientNode.Get(0),   &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Client&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(lbNode.Get(0),       &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;LoadBalancer&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(serverNodes.Get(0),  &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Server1&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(serverNodes.Get(1),  &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Server2&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(serverNodes.Get(2),  &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Server3&quot;&lt;/span&gt;);

    anim.UpdateNodeColor(clientNode.Get(0),   0,   0, 255);  &lt;span style=&quot;color: #75715e;&quot;&gt;// Blue&lt;/span&gt;
    anim.UpdateNodeColor(lbNode.Get(0),      255, 165,  0);  &lt;span style=&quot;color: #75715e;&quot;&gt;// Orange&lt;/span&gt;
    anim.UpdateNodeColor(serverNodes.Get(0),  0, 200,   0);  &lt;span style=&quot;color: #75715e;&quot;&gt;// Green&lt;/span&gt;
    anim.UpdateNodeColor(serverNodes.Get(1),  0, 200,   0);
    anim.UpdateNodeColor(serverNodes.Get(2),  0, 200,   0);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 8. Open .dat files and schedule throughput sampling&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Opening throughput data files ...&quot;&lt;/span&gt;);
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        std::ostringstream fname;
        fname &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;throughput_server&quot;&lt;/span&gt; &amp;lt;&amp;lt; (i + 1) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;.dat&quot;&lt;/span&gt;;
        g_datFiles[i].open(fname.str());
        g_datFiles[i] &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;# Time(s)\tThroughput(Mbps)\n&quot;&lt;/span&gt;;
    }

    Simulator::Schedule(Seconds(SAMPLE_INTERVAL), &amp;amp;SampleThroughput, simDuration);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 9. Run simulation&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Starting simulation ...&quot;&lt;/span&gt;);
    Simulator::Stop(Seconds(simDuration + 1.0));
    Simulator::Run();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 10. FlowMonitor results&lt;/span&gt;
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n========== FlowMonitor Statistics ==========&quot;&lt;/span&gt;);
    flowMon-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowMonHelper.GetClassifier());

    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = flowMon-&amp;gt;GetFlowStats();

    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; &amp;amp;kv : stats)
    {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(kv.first);
        FlowMonitor::FlowStats        s = kv.second;

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; duration  = s.timeLastRxPacket.GetSeconds()
                         - s.timeFirstTxPacket.GetSeconds();
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; tput      = (duration &amp;gt; 0)
                         ? (s.rxBytes * 8.0) / (duration * 1e6)
                         : 0.0;
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; meanDelay = (s.rxPackets &amp;gt; 0)
                         ? s.delaySum.GetSeconds() / s.rxPackets * 1000.0
                         : 0.0;
        uint64_t lost    = s.txPackets - s.rxPackets;

        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n--- Flow &quot;&lt;/span&gt; &amp;lt;&amp;lt; kv.first &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ---\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Src  : &quot;&lt;/span&gt; &amp;lt;&amp;lt; t.sourceAddress      &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;:&quot;&lt;/span&gt; &amp;lt;&amp;lt; t.sourcePort      &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Dst  : &quot;&lt;/span&gt; &amp;lt;&amp;lt; t.destinationAddress &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;:&quot;&lt;/span&gt; &amp;lt;&amp;lt; t.destinationPort &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Proto: &quot;&lt;/span&gt; &amp;lt;&amp;lt; (uint16_t)t.protocol &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; (17=UDP)\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  TxPkts : &quot;&lt;/span&gt; &amp;lt;&amp;lt; s.txPackets    &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  RxPkts : &quot;&lt;/span&gt; &amp;lt;&amp;lt; s.rxPackets    &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  LostPkts : &quot;&lt;/span&gt; &amp;lt;&amp;lt; lost         &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Throughput : &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(4)
                                      &amp;lt;&amp;lt; tput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  Mean Delay : &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(4)
                                      &amp;lt;&amp;lt; meanDelay &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ms\n&quot;&lt;/span&gt;;
    }

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Save FlowMonitor XML&lt;/span&gt;
    flowMon-&amp;gt;SerializeToXmlFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;flowmon.xml&quot;&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\nflowmon.xml saved.&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// 11. Close .dat files and write gnuplot script&lt;/span&gt;
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; NUM_SERVERS; ++i)
    {
        g_datFiles[i].close();
    }

    {
        std::ofstream plt(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;throughput.plt&quot;&lt;/span&gt;);
        plt &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;# Gnuplot script — Throughput vs. Time\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;# Run: gnuplot throughput.plt\n\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set terminal pngcairo size 900,500 enhanced font &#39;Helvetica,12&#39;\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set output &#39;throughput.png&#39;\n\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set title &#39;Web-Server Farm: Per-Server Throughput vs. Time\\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;24BPS1021 — P2P Load Balancing Simulation&#39;\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set xlabel &#39;Time (s)&#39;\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set ylabel &#39;Throughput (Mbps)&#39;\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set xrange [0:&quot;&lt;/span&gt; &amp;lt;&amp;lt; simDuration &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;]\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set yrange [0:5]\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set grid\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set key top right\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set style data linespoints\n\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;plot &#39;throughput_server1.dat&#39; using 1:2 title &#39;Server1&#39; lc rgb &#39;#e74c3c&#39; lw 2 pt 7,\\\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;     &#39;throughput_server2.dat&#39; using 1:2 title &#39;Server2&#39; lc rgb &#39;#2ecc71&#39; lw 2 pt 5,\\\n&quot;&lt;/span&gt;
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;     &#39;throughput_server3.dat&#39; using 1:2 title &#39;Server3&#39; lc rgb &#39;#3498db&#39; lw 2 pt 9\n&quot;&lt;/span&gt;;
        plt.close();
    }

    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;throughput.plt written.&quot;&lt;/span&gt;);
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;animation.xml written.&quot;&lt;/span&gt;);
    NS_LOG_INFO(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\nAll done! Run: gnuplot throughput.plt  → throughput.png&quot;&lt;/span&gt;);

    Simulator::Destroy();
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;GNUPLOT GRAPH:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 1.5em 0px; text-align: center;&quot;&gt;
  &lt;img alt=&quot;Gnuplot Web-Server Farm Throughput Graph&quot; height=&quot;361&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEipnrzqyFb6iSsgqzj58nYdP4Lr85UigXyLipb4sST0EJxRUung1pAoKANwUv2GcfFfh1vm3v8yCf2WHtxz4mvoEFU2uKSCZfyEgdv3puEufokwF0DaiHG4oJqaXLRCzhU3DfyQlrmvLBpbStcVoLQNR9_ug3g4gtvdl7Ignya61G7HZO8-r0PWRTkFa7k&quot; style=&quot;height: auto; max-width: 100%;&quot; width=&quot;642&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;NETANIM VISUALIZATION:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 1.5em 0px; text-align: center;&quot;&gt;
  &lt;img alt=&quot;NetAnim Web-Server Farm Topology&quot; height=&quot;388&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiv4hyhGQCVCoP8u0SqIJNbFFFW9eQoCc1QMeqRtOAb0h9zptJMo07UnIpZkSLwRk_OOj_ipPOmrhZQa1Z3Fv_D3us5a_b3G0yqOXKbsMKyaszj8ZppUccQHz-PYFhSOSHuP8Ag7XXe2u-YUXT2S-Vx2cBEUrpueWN_8tBMThKR5LLy5vpVfnK66JzDKGY&quot; style=&quot;height: auto; max-width: 100%;&quot; width=&quot;642&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;FLOWMONITOR RESULT:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 1.5em 0px; text-align: center;&quot;&gt;
  &lt;img alt=&quot;FlowMonitor Console Output&quot; height=&quot;429&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiSVhZldifm1ukB5LhDzqWjBwhiNc2elYEL55YH8nYFB7ouciv8mdYG_QgdIw80enkkbRyIVUcnSTiED_O9xamZB8W4QtgRyi_h-jPZH6xPSE3sjcpmHdJk9fCrOBz1Dz1IeWLZ-36o43nrwkc8JHtRJ-M4AbPC_wbL5noxYgBh4OYNm895H70gxCUrGGs&quot; style=&quot;height: auto; max-width: 100%;&quot; width=&quot;642&quot; /&gt;
&lt;/div&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/8253053210959571693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/09/web-server-farm-simulation-with-load.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8253053210959571693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8253053210959571693'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/09/web-server-farm-simulation-with-load.html' title='Web Server Farm Simulation with Load Balancing Using P2P Links'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEipnrzqyFb6iSsgqzj58nYdP4Lr85UigXyLipb4sST0EJxRUung1pAoKANwUv2GcfFfh1vm3v8yCf2WHtxz4mvoEFU2uKSCZfyEgdv3puEufokwF0DaiHG4oJqaXLRCzhU3DfyQlrmvLBpbStcVoLQNR9_ug3g4gtvdl7Ignya61G7HZO8-r0PWRTkFa7k=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-7671384259622032957</id><published>2026-08-26T11:00:00.000+05:30</published><updated>2026-09-08T14:15:11.838+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulate Stop-and-Wait ARQ over a point-to-point link with varying bit-error rates (0–20%)  | NS3 Project 30</title><content type='html'>&lt;div style=&quot;background: linear-gradient(135deg, #1a365d 0%, #2a4365 100%); border-bottom: 5px solid #3182ce; color: #ffffff; padding: 25px 20px; border-radius: 6px; margin-bottom: 25px;&quot;&gt;
    &lt;h1 style=&quot;color: #ffffff; margin: 0 0 10px 0; font-size: 26px; line-height: 1.3;&quot;&gt;Network Congestion and Buffer Overflow&lt;/h1&gt;
    &lt;h2 style=&quot;color: #bee3f8; margin: 0; font-size: 18px; font-weight: normal; border: none; padding: 0;&quot;&gt;Simulating DropTail vs. RED Queue Disciplines in NS-3&lt;/h2&gt;
&lt;/div&gt;

&lt;h2&gt;1. Introduction&lt;/h2&gt;
&lt;p&gt;Network congestion occurs when the incoming traffic load exceeds the processing or transmission capacity of network resources such as routers or links. In packet-switched networks, routers temporarily store packets in buffers (queues) before forwarding them. When the arrival rate of packets is higher than the departure rate, the queue length increases progressively.&lt;/p&gt;

&lt;p&gt;Once the buffer reaches its maximum capacity, any additional incoming packets are dropped, resulting in buffer overflow. This leads to packet loss, increased queuing delay, reduced throughput, and overall degradation in network performance. Efficient queue management techniques are therefore essential to control congestion and maintain network stability.&lt;/p&gt;

&lt;h2&gt;2. Queue Management Techniques: DropTail vs. RED&lt;/h2&gt;
&lt;p&gt;Queue disciplines define how packets are stored and discarded in a router buffer. The design and operational goals behind passive and active queue management are fundamentally divergent:&lt;/p&gt;

&lt;h3&gt;DropTail Queue (Passive Queue Management)&lt;/h3&gt;
&lt;p&gt;DropTail follows a simple First-In-First-Out (FIFO) approach. Packets are accepted until the buffer is completely full. Once full, all incoming packets are dropped until space becomes available. This results in sudden packet loss bursts and poor congestion signaling to the end systems.&lt;/p&gt;

&lt;h3&gt;Random Early Detection (RED) (Active Queue Management)&lt;/h3&gt;
&lt;p&gt;RED is an advanced queue management technique that monitors the average queue size and begins dropping packets probabilistically before the buffer becomes full. This early detection mechanism helps signal congestion to the sender (forcing TCP windows to shrink or flagging packet distribution changes), preventing abrupt overflow and improving overall network performance.&lt;/p&gt;

&lt;h2&gt;3. Performance Metrics&lt;/h2&gt;
&lt;p&gt;To evaluate and compare the effectiveness of DropTail and RED, the following key performance indicators are utilized during validation:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Throughput:&lt;/strong&gt; The rate at which data is successfully received at the destination over time. Higher throughput indicates better utilisation of network resources.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Packet Loss Ratio (PLR):&lt;/strong&gt; The percentage of packets dropped due to congestion and buffer overflow. Lower PLR indicates better congestion handling.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Queue Length Behaviour:&lt;/strong&gt; The variation in buffer occupancy over time. Stable queue behaviour indicates efficient congestion control.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;End-to-End Delay:&lt;/strong&gt; The total time taken for a packet to travel from source to destination. Increased congestion leads to higher delays.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;4. Simulation Scenario and Network Topology&lt;/h2&gt;
&lt;p&gt;The experiment is conducted using a multi-node network topology designed to intentionally create congestion at a bottleneck link. The topology consists of multiple sender nodes transmitting high-rate UDP traffic towards a single receiver node through two intermediate routers. The access links connecting the senders to the first router operate at high bandwidth, while the link between the two routers is configured as a low-bandwidth bottleneck.&lt;/p&gt;

&lt;p&gt;Due to the mismatch between the incoming traffic rate and the bottleneck capacity, packets accumulate at the router queue, leading to buffer overflow. The exact same topology is simulated twice—once using DropTail and once using RED—to observe differences in baseline behaviour.&lt;/p&gt;

&lt;h2&gt;5. Simulation Parameters&lt;/h2&gt;
&lt;p&gt;The experiment is modelled using the NS-3 discrete-event network simulator, with network traffic data captured and analysed via the FlowMonitor module. Environmental constraints and protocol configurations include:&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;8&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 100%; margin: 20px 0; border: 1px solid #e2e8f0;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #2b6cb0; color: #ffffff;&quot;&gt;
            &lt;th style=&quot;text-align: left; padding: 10px; border: 1px solid #2b6cb0;&quot;&gt;Parameter&lt;/th&gt;
            &lt;th style=&quot;text-align: left; padding: 10px; border: 1px solid #2b6cb0;&quot;&gt;Assigned Value&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Simulator Environment&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;NS-3&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #f7fafc;&quot;&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Traffic Type&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;UDP&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Number of Senders&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;2 Senders&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #f7fafc;&quot;&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Access Link Bandwidth&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;10 Mbps&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Access Link Delay&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;2 ms&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #f7fafc;&quot;&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Bottleneck Link Bandwidth&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;1 Mbps&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Bottleneck Link Delay&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;10 ms&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #f7fafc;&quot;&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Queue Discipline&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;DropTail / RED (Toggled via flag)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Simulation Time&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;15 seconds (Data tracked for 10s window)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #f7fafc;&quot;&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;&lt;strong&gt;Traffic Rate&lt;/strong&gt;&lt;/td&gt;
            &lt;td style=&quot;padding: 8px 10px; border: 1px solid #e2e8f0;&quot;&gt;5 Mbps per sender (10 Mbps cumulative load)&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;6. Implementation Source Code&lt;/h2&gt;
&lt;p&gt;The simulation script is written in C++ using the structural modules of NS-3. Save this code inside your local &lt;code&gt;scratch/fifo.cc&lt;/code&gt; file:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/traffic-control-module.h&quot;
#include &quot;ns3/netanim-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;BufferOverflowSimulation&quot;);

static std::ofstream throughputFile;
static uint64_t lastTotalRx = 0;

// Function to calculate throughput
void CalculateThroughput(Ptr&amp;lt;FlowMonitor&amp;gt; flowMonitor)
{
    flowMonitor-&amp;gt;CheckForLostPackets();
    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = flowMonitor-&amp;gt;GetFlowStats();

    uint64_t totalRx = 0;
    for (auto &amp;amp;flow : stats)
    {
        totalRx += flow.second.rxBytes;
    }

    double timeNow = Simulator::Now().GetSeconds();
    double throughput = (totalRx - lastTotalRx) * 8.0 / 1000000; // Mbps

    throughputFile &amp;lt;&amp;lt; timeNow &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; std::endl;

    lastTotalRx = totalRx;

    Simulator::Schedule(Seconds(1.0), &amp;amp;CalculateThroughput, flowMonitor);
}

int main(int argc, char *argv[])
{
    bool useRed = false;
    CommandLine cmd;
    cmd.AddValue(&quot;useRed&quot;, &quot;Use RED queue discipline&quot;, useRed);
    cmd.Parse(argc, argv);

    // Nodes
    NodeContainer senders, routers, receiver;
    senders.Create(2);
    routers.Create(2);
    receiver.Create(1);

    // Internet
    InternetStackHelper stack;
    stack.InstallAll();

    // Links
    PointToPointHelper fast, slow;
    fast.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;10Mbps&quot;));
    fast.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));

    slow.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;1Mbps&quot;));
    slow.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;10ms&quot;));

    NetDeviceContainer d1 = fast.Install(senders.Get(0), routers.Get(0));
    NetDeviceContainer d2 = fast.Install(senders.Get(1), routers.Get(0));
    NetDeviceContainer d3 = slow.Install(routers.Get(0), routers.Get(1)); // bottleneck
    NetDeviceContainer d4 = fast.Install(routers.Get(1), receiver.Get(0));

    // Queue Discipline
    TrafficControlHelper tch;

    if (useRed)
    {
        tch.SetRootQueueDisc(&quot;ns3::RedQueueDisc&quot;);
    }
    else
    {
        tch.SetRootQueueDisc(&quot;ns3::PfifoFastQueueDisc&quot;);
    }

    tch.Install(d3);

    // IP Addressing
    Ipv4AddressHelper addr;
    addr.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.0&quot;);
    addr.Assign(d1);

    addr.SetBase(&quot;10.1.2.0&quot;, &quot;255.255.255.0&quot;);
    addr.Assign(d2);

    addr.SetBase(&quot;10.1.3.0&quot;, &quot;255.255.255.0&quot;);
    addr.Assign(d3);

    addr.SetBase(&quot;10.1.4.0&quot;, &quot;255.255.255.0&quot;);
    addr.Assign(d4);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    // Applications
    uint16_t port = 9;

    OnOffHelper onoff(&quot;ns3::UdpSocketFactory&quot;, 
                      Address(InetSocketAddress(&quot;10.1.4.2&quot;, port)));

    onoff.SetConstantRate(DataRate(&quot;5Mbps&quot;));

    ApplicationContainer apps = onoff.Install(senders);
    apps.Start(Seconds(1.0));
    apps.Stop(Seconds(15.0));

    PacketSinkHelper sink(&quot;ns3::UdpSocketFactory&quot;, 
                          Address(InetSocketAddress(Ipv4Address::GetAny(), port)));

    ApplicationContainer sinkApp = sink.Install(receiver.Get(0));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(15.0));

    // Flow Monitor
    FlowMonitorHelper flowHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt; flowMonitor = flowHelper.InstallAll();

    // Throughput file
    throughputFile.open(&quot;throughput.dat&quot;);

    Simulator::Schedule(Seconds(1.0), &amp;amp;CalculateThroughput, flowMonitor);

    // NetAnim
    AnimationInterface anim(&quot;anim.xml&quot;);

    anim.SetConstantPosition(senders.Get(0), 0, 50);
    anim.SetConstantPosition(senders.Get(1), 0, 10);
    anim.SetConstantPosition(routers.Get(0), 20, 30);
    anim.SetConstantPosition(routers.Get(1), 50, 30);
    anim.SetConstantPosition(receiver.Get(0), 80, 30);

    Simulator::Stop(Seconds(15.0));
    Simulator::Run();

    flowMonitor-&amp;gt;SerializeToXmlFile(&quot;flowmon.xml&quot;, true, true);

    Simulator::Destroy();
    throughputFile.close();

    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;div style=&quot;background-color: #ebf8ff; border-left: 4px solid #3182ce; border-radius: 0 4px 4px 0; color: #2d3748; margin: 18px 0; padding: 12px 15px;&quot;&gt;
    &lt;div style=&quot;color: #2b6cb0; font-weight: bold; margin-bottom: 5px;&quot;&gt;Execution Commands&lt;/div&gt;
    To run the baseline DropTail evaluation:
    &lt;pre style=&quot;margin: 6px 0;&quot;&gt;&lt;code&gt;./ns3 run scratch/fifo.cc&lt;/code&gt;&lt;/pre&gt;
    To run the active RED alternative, pass the dynamic parameter:
    &lt;pre style=&quot;margin: 6px 0;&quot;&gt;&lt;code&gt;./ns3 run &quot;scratch/fifo.cc --useRed=true&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2&gt;7. Outputs and Multi-Tool Analysis&lt;/h2&gt;

&lt;h3&gt;Animation (NetAnim / Python Visualization)&lt;/h3&gt;
&lt;p&gt;Using NetAnim, the spatial configuration shows packet streams converging smoothly from the high-speed links onto Router 0, while the queue status indicators visually emphasize backlog buildup preceding the bottleneck link to Router 1.&lt;/p&gt;

&lt;h3&gt;Graph (Throughput vs. Time)&lt;/h3&gt;
&lt;p&gt;Plotting the output files generated during the execution runtime maps a stark operational difference. DropTail charts clear performance cliffs, whereas RED presents a flatter, uniform data line.&lt;/p&gt;

&lt;h3&gt;Wireshark Analysis&lt;/h3&gt;
&lt;p&gt;Wireshark was utilised to inspect packet-level transmission intervals using standard PCAP files generated natively by NS-3. Deep-dive captures show precise sequences of continuous drop periods in DropTail versus randomised drops in RED.&lt;/p&gt;

&lt;h2&gt;8. Key Results and Inference&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;DropTail scenario&lt;/strong&gt;, the queue fills completely before any packets are dropped. This results in sudden bursts of packet loss, increased delay, and unstable throughput. Since packet drops only happen after the buffer is entirely full, there is no early indication of congestion, leading to inefficient network utilisation and traffic synchronisation issues.&lt;/p&gt;

&lt;p&gt;In contrast, &lt;strong&gt;RED begins dropping packets&lt;/strong&gt; before the buffer reaches full capacity. This probabilistic early dropping helps regulate the incoming traffic rate and prevents abrupt congestion bottlenecks. As a result, the queue length remains more stable, packet loss is distributed evenly, and throughput remains relatively consistent throughout the execution duration.&lt;/p&gt;

&lt;!-- NetAnim Image Table --&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjPQBL8SaB8zlsLaPxB2ctYW51YeteoosNAi_Su-bCF8dj04-_GntZIvoJWy0XtX0gryyGesyOLYBjiclD1J-7zCnHh9fbdj2zuIjA9oQXFbzmkQtjVFpxoZTKnILy2VfR2NPIui_pzr4BxXU59DtMVSKtXHyu2oYprKxKpa5dNWQVoAF0WmjK6aOCaPrg&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
                    &lt;img alt=&quot;NetAnim for Queue&quot; data-original-height=&quot;474&quot; data-original-width=&quot;867&quot; height=&quot;350&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjPQBL8SaB8zlsLaPxB2ctYW51YeteoosNAi_Su-bCF8dj04-_GntZIvoJWy0XtX0gryyGesyOLYBjiclD1J-7zCnHh9fbdj2zuIjA9oQXFbzmkQtjVFpxoZTKnILy2VfR2NPIui_pzr4BxXU59DtMVSKtXHyu2oYprKxKpa5dNWQVoAF0WmjK6aOCaPrg=w640-h350&quot; width=&quot;640&quot; /&gt;
                &lt;/a&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;NetAnim for Queue&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;div style=&quot;background-color: #ebf8ff; border-left: 4px solid #3182ce; border-radius: 0 4px 4px 0; color: #2d3748; margin: 20px 0; padding: 14px 18px;&quot;&gt;
    &lt;div style=&quot;color: #2b6cb0; font-weight: bold; margin-bottom: 6px;&quot;&gt;Core Inference&lt;/div&gt;
    The simulation clearly demonstrates that RED significantly outperforms DropTail in handling intense network congestion. While DropTail is simple to implement, it suffers from late congestion detection and burst packet losses. RED, through early congestion detection and controlled packet dropping, improves overall network stability, minimises processing delay variations, and maintains smoother throughput. Active queue management techniques like RED are fundamentally more suitable for modern high-traffic topologies where robust congestion control is critical.
&lt;/div&gt;

&lt;div style=&quot;background-color: #f7fafc; border-radius: 4px; border: 1px dashed #cbd5e0; margin-top: 25px; padding: 12px 15px;&quot;&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#NetworkSimulation&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#NS3&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#NetworkCongestion&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#BufferOverflow&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#QueueManagement&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#DropTail&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#REDQueue&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#WiresharkAnalysis&lt;/span&gt;
    &lt;span style=&quot;color: #2b6cb0; display: inline-block; margin-right: 8px;&quot;&gt;#TechDeepDive&lt;/span&gt;
&lt;/div&gt;

&lt;!-- Google AdSense --&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;!-- YouTube Subscribe Button --&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/7671384259622032957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/simulate-stop-and-wait-arq-over-point.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/7671384259622032957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/7671384259622032957'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/simulate-stop-and-wait-arq-over-point.html' title='Simulate Stop-and-Wait ARQ over a point-to-point link with varying bit-error rates (0–20%)  | NS3 Project 30'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjPQBL8SaB8zlsLaPxB2ctYW51YeteoosNAi_Su-bCF8dj04-_GntZIvoJWy0XtX0gryyGesyOLYBjiclD1J-7zCnHh9fbdj2zuIjA9oQXFbzmkQtjVFpxoZTKnILy2VfR2NPIui_pzr4BxXU59DtMVSKtXHyu2oYprKxKpa5dNWQVoAF0WmjK6aOCaPrg=s72-w640-h350-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-5132589412081494695</id><published>2026-08-25T11:00:00.000+05:30</published><updated>2026-09-08T14:16:38.105+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulate and trace TCP Slow-Start, Congestion Avoidance, and Fast Recovery phases | NS3 Project 29</title><content type='html'>&lt;div style=&quot;background: linear-gradient(135deg, #011892 0%, #1a365d 100%); border-bottom: 5px solid #3182ce; color: #ffffff; padding: 25px 20px; border-radius: 6px; margin-bottom: 25px;&quot;&gt;
    &lt;h1 style=&quot;color: #ffffff; margin: 0; font-size: 24px; line-height: 1.3;&quot;&gt;Analysis of TCP Congestion Control Phases&lt;/h1&gt;
    &lt;p style=&quot;color: #bee3f8; margin: 8px 0 0 0; font-size: 15px;&quot;&gt;Simulating TCP NewReno on a Dumbbell Topology in NS-3&lt;/p&gt;
&lt;/div&gt;

&lt;h2&gt;1. Project Overview&lt;/h2&gt;
&lt;p&gt;This project simulates a Dumbbell Topology to observe how TCP NewReno manages network congestion. By creating a bottleneck link with limited bandwidth (1 Mbps), we force the TCP protocol to transition through its three primary phases: Slow-Start, Congestion Avoidance, and Fast Recovery.&lt;/p&gt;

&lt;h2&gt;2. LLM Source Documentation&lt;/h2&gt;
&lt;p&gt;To develop the source code (&lt;code&gt;24bps1052.cc&lt;/code&gt;), the following AI assistant was utilised:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;LLM Used:&lt;/strong&gt; Gemini 3 Flash (Google)&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Prompt Provided:&lt;/strong&gt;
        &lt;blockquote style=&quot;background-color: #f7fafc; border-left: 4px solid #3182ce; margin: 10px 0; padding: 10px 15px; font-style: italic;&quot;&gt;
            &amp;quot;Hey, can you help me write an ns-3.44 script for my networking lab? I need to save it as scratch/23bps1xxx.cc. I need a Dumbbell Topology with 4 nodes: Node 0 and 1 connect to Node 2 (the router), and Node 2 connects to Node 3. Set the link between 2 and 3 to 1Mbps so it becomes a bottleneck. Use TCP NewReno for the simulation. I need to generate a trace file called cwnd_trace.dat for Gnuplot and an XML file called tcp_variants.xml for NetAnim. Make sure the code runs with the command ./ns3 run scratch/24bps1052.cc and lasts for about 20 seconds.&amp;quot;
        &lt;/blockquote&gt;
    &lt;/li&gt;
&lt;/ul&gt;

&lt;a href=&quot;http://www.nsnam.com/2026/08/simulate-and-trace-tcp-slow-start.html#more&quot;&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/5132589412081494695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/simulate-and-trace-tcp-slow-start.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5132589412081494695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5132589412081494695'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/simulate-and-trace-tcp-slow-start.html' title='Simulate and trace TCP Slow-Start, Congestion Avoidance, and Fast Recovery phases | NS3 Project 29'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjjDPS-gidjK8K4w01hSo0d2y9zZUuAawpVsa0pJ2wFzMgKKZnKhJem0J94QADLIk8Vhehzu109N3JkQiAG5SE_a7lpskKYveoaHS8FwYgt2RqCYHKusalJclBlCjf34pjboAjrV_h2guuCELG12_ztZd51nN4K4VvKBo0Z7ROa_u4zM9L8z5ci3-uakFo=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-5841838400942928786</id><published>2026-08-24T11:00:00.000+05:30</published><updated>2026-09-08T14:17:56.417+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Simulation of  Link-State routing (Dijkstra) in a 12-router wired network | NS3 Project  28</title><content type='html'>&lt;div style=&quot;background: linear-gradient(135deg, #1a365d 0%, #2a4365 100%); border-bottom: 5px solid #3182ce; color: #ffffff; padding: 25px 20px; border-radius: 6px; margin-bottom: 25px;&quot;&gt;
    &lt;h1 style=&quot;color: #ffffff; margin: 0 0 10px 0; font-size: 24px; line-height: 1.3;&quot;&gt;Simulate Link-State Routing Using OLSR in NS-3&lt;/h1&gt;
    &lt;h2 style=&quot;color: #bee3f8; margin: 0; font-size: 16px; font-weight: normal; border: none; padding: 0;&quot;&gt;Performance and Convergence Analysis in a 12-Router Wired Network&lt;/h2&gt;
&lt;/div&gt;

&lt;h2&gt;Requirements&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Topology:&lt;/strong&gt; Create a network with 12 nodes connected in a grid/mesh topology.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Link Costs:&lt;/strong&gt; Assign different link costs by varying propagation delay or data rate across links.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Traffic Generation:&lt;/strong&gt; Generate UDP traffic between a source node (R0) and a destination node (R11).&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Failure &amp;amp; Recovery:&lt;/strong&gt; Introduce a link failure at 40 seconds and restore the link at 44 seconds.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Metrics:&lt;/strong&gt; Measure and display the convergence time of the routing protocol.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Tracing:&lt;/strong&gt; Enable ASCII/PCAP tracing and generate NetAnim visualization.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Diagram:&lt;/strong&gt; Provide a Mermaid diagram representing the 12-node network topology.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;The prompt above represents the refined, final instruction formulated after iterative tuning with Gemini and ChatGPT alongside standard NS-3 OLSR examples.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Network Topology&lt;/h2&gt;
&lt;p&gt;The network topology used in this simulation consists of 12 routers arranged in a structured grid (mesh-like) configuration labeled from &lt;strong&gt;R0 to R11&lt;/strong&gt; interconnected using point-to-point links.&lt;/p&gt;

&lt;p&gt;The topology is organized into three rows of four routers each:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Row 1:&lt;/strong&gt; R0 &amp;ndash; R1 &amp;ndash; R2 &amp;ndash; R3&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Row 2:&lt;/strong&gt; R4 &amp;ndash; R5 &amp;ndash; R6 &amp;ndash; R7&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Row 3:&lt;/strong&gt; R8 &amp;ndash; R9 &amp;ndash; R10 &amp;ndash; R11&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Horizontal links connect routers within the same row, while vertical links connect routers between adjacent columns. This creates redundant routing paths between source and destination nodes, enabling route computation via the OLSR (Optimized Link State Routing) protocol using shortest-path calculations.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Link Delays &amp;amp; Costs:&lt;/strong&gt; Each link is assigned a specific delay value (from 2 ms to 13 ms) to represent variable path metrics.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Dynamic Event:&lt;/strong&gt; Link failure is injected between routers &lt;strong&gt;R5 and R6&lt;/strong&gt; at &lt;code&gt;t = 40s&lt;/code&gt; and restored at &lt;code&gt;t = 44s&lt;/code&gt;, triggering route recomputation and path failover.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Traffic Flow:&lt;/strong&gt; Constant bit-rate UDP data flows from &lt;strong&gt;R0&lt;/strong&gt; to &lt;strong&gt;R11&lt;/strong&gt; across multiple hops.&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- Network Topology Screenshot --&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Network Topology Diagram&quot; height=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiozhLo2D0L5cgsw1e7yD52-DHWiYCkg2AbePjzVjSLWsCO-WuhWd0ecaR0ebEpun2COFyP9JQ-1j5Ooc-f-0-daO89MP8twC1cPWhjJ9kiYh_SkUFaH4wBugrJbuGedACMI0RCU-De4UCytk5Z0Sxrql-T8Qx2LqeKsrrfofySeeuoIL_h68NTuwgu1gw&quot; style=&quot;max-width: 100%;&quot; width=&quot;172&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Grid Layout Overview&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Mermaid Topology Specification&lt;/h2&gt;
&lt;pre class=&quot;mermaid&quot;&gt;&lt;code&gt;graph TD
    %% Row 1
    0 --- 1
    1 --- 2
    2 --- 3

    %% Row 2
    4 --- 5
    5 --- 6
    6 --- 7

    %% Row 3
    8 --- 9
    9 --- 10
    10 --- 11

    %% Vertical Connections (Columns)
    0 --- 4
    4 --- 8
    1 --- 5
    5 --- 9
    2 --- 6
    6 --- 10
    3 --- 7
    7 --- 11

    %% Highlighting Source and Sink
    style 0 fill:#f96,stroke:#333,stroke-width:4px
    style 11 fill:#69f,stroke:#333,stroke-width:4px

    %% Failed Link (R5 to R6)
    linkStyle 4 stroke:#ff0000,stroke-width:2px;&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Simulation Source Code&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;/*
 * OLSR 12-node Link-State Simulation with Failure &amp;amp; Recovery
 */
#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/olsr-helper.h&quot;
#include &quot;ns3/ipv4-list-routing-helper.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/netanim-module.h&quot;
#include &quot;ns3/seq-ts-header.h&quot;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;OLSRSimulation12Nodes&quot;);

double lastRxBeforeFailure = 0.0;
double firstRxAfterFailure = -1.0;
bool failureStarted = false;
static uint32_t expectedSeq = 0;
static bool firstPacket = true;
static bool lossDetected = false;

void PacketRxCallback(Ptr&amp;lt;const Packet&amp;gt; packet, const Address &amp;amp;addr)
{
    double now = Simulator::Now().GetSeconds();
    SeqTsHeader seqTs;
    packet-&amp;gt;PeekHeader(seqTs);
    uint32_t seq = seqTs.GetSeq();

    if (firstPacket)
    {
        expectedSeq = seq;
        firstPacket = false;
    }

    // Capture timing before failure
    if (now &amp;lt; 40.0)
    {
        lastRxBeforeFailure = now;
    }

    // Detect packet loss
    if (seq &amp;gt; expectedSeq + 5)
    {
        lossDetected = true;
    }

    // Detect recovery after failure execution
    if (lossDetected &amp;amp;&amp;amp; firstRxAfterFailure &amp;lt; 0 &amp;amp;&amp;amp; now &amp;gt; 40.0)
    {
        firstRxAfterFailure = now;
    }

    expectedSeq = seq;
}

// Function to bring link down
void TearDownLink(Ptr&amp;lt;Node&amp;gt; n1, Ptr&amp;lt;Node&amp;gt; n2, uint32_t i1, uint32_t i2)
{
    n1-&amp;gt;GetObject&amp;lt;Ipv4&amp;gt;()-&amp;gt;SetDown(i1);
    n2-&amp;gt;GetObject&amp;lt;Ipv4&amp;gt;()-&amp;gt;SetDown(i2);
}

// Function to bring link up
void BringUpLink(Ptr&amp;lt;Node&amp;gt; n1, Ptr&amp;lt;Node&amp;gt; n2, uint32_t i1, uint32_t i2)
{
    n1-&amp;gt;GetObject&amp;lt;Ipv4&amp;gt;()-&amp;gt;SetUp(i1);
    n2-&amp;gt;GetObject&amp;lt;Ipv4&amp;gt;()-&amp;gt;SetUp(i2);
}

int main(int argc, char *argv[])
{
    CommandLine cmd(__FILE__);
    cmd.Parse(argc, argv);

    NodeContainer nodes;
    nodes.Create(12);

    // Routing setup
    OlsrHelper olsr;
    Ipv4ListRoutingHelper list;
    list.Add(olsr, 10);

    InternetStackHelper internet;
    internet.SetRoutingHelper(list);
    internet.Install(nodes);

    PointToPointHelper p2p;
    std::vector&amp;lt;NetDeviceContainer&amp;gt; devices;

    std::vector&amp;lt;std::string&amp;gt; delays = {
        &quot;2ms&quot;, &quot;3ms&quot;, &quot;4ms&quot;, &quot;5ms&quot;, &quot;6ms&quot;, &quot;7ms&quot;,
        &quot;8ms&quot;, &quot;9ms&quot;, &quot;10ms&quot;, &quot;11ms&quot;, &quot;12ms&quot;, &quot;13ms&quot;
    };

    int d = 0;
    auto connect = [&amp;amp;](int a, int b) {
        p2p.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;5Mbps&quot;));
        p2p.SetChannelAttribute(&quot;Delay&quot;, StringValue(delays[d++ % delays.size()]));
        devices.push_back(p2p.Install(nodes.Get(a), nodes.Get(b)));
    };

    // Horizontal links
    connect(0, 1); connect(1, 2); connect(2, 3);
    connect(4, 5); connect(5, 6); connect(6, 7);
    connect(8, 9); connect(9, 10); connect(10, 11);

    // Vertical links
    connect(0, 4); connect(4, 8);
    connect(1, 5); connect(5, 9);
    connect(2, 6); connect(6, 10);
    connect(3, 7); connect(7, 11);

    // IP Addressing
    Ipv4AddressHelper ipv4;
    std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; interfaces;

    for (size_t i = 0; i &amp;lt; devices.size(); i++)
    {
        std::ostringstream subnet;
        subnet &amp;lt;&amp;lt; &quot;10.1.&quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &quot;.0&quot;;
        ipv4.SetBase(subnet.str().c_str(), &quot;255.255.255.0&quot;);
        interfaces.push_back(ipv4.Assign(devices[i]));
    }

    uint16_t port = 9;

    // Source application on Node 0
    OnOffHelper onoff(&quot;ns3::UdpSocketFactory&quot;, 
                      InetSocketAddress(interfaces.back().GetAddress(1), port));
    onoff.SetConstantRate(DataRate(&quot;448kb/s&quot;));
    onoff.SetAttribute(&quot;EnableSeqTsSizeHeader&quot;, BooleanValue(true));
    
    ApplicationContainer app = onoff.Install(nodes.Get(0));
    app.Start(Seconds(5.0));
    app.Stop(Seconds(100.0));

    // Sink application on Node 11
    PacketSinkHelper sink(&quot;ns3::UdpSocketFactory&quot;, 
                          InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApp = sink.Install(nodes.Get(11));
    sinkApp.Get(0)-&amp;gt;TraceConnectWithoutContext(&quot;Rx&quot;, MakeCallback(&amp;amp;PacketRxCallback));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(110.0));

    // Schedule Link Failure and Restoration between Node 5 and 6
    Simulator::Schedule(Seconds(40.0), &amp;amp;TearDownLink, nodes.Get(5), nodes.Get(6), 2, 1);
    Simulator::Schedule(Seconds(44.0), &amp;amp;BringUpLink, nodes.Get(5), nodes.Get(6), 2, 1);

    // Tracing
    AsciiTraceHelper ascii;
    p2p.EnableAsciiAll(ascii.CreateFileStream(&quot;olsr-12nodes.tr&quot;));
    p2p.EnablePcapAll(&quot;olsr-12nodes&quot;);

    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    AnimationInterface anim(&quot;project.xml&quot;);

    Simulator::Stop(Seconds(110.0));
    NS_LOG_INFO(&quot;Run Simulation&quot;);
    Simulator::Run();

    monitor-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier = DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowmon.GetClassifier());
    auto stats = monitor-&amp;gt;GetFlowStats();

    for (auto &amp;amp;flow : stats)
    {
        std::cout &amp;lt;&amp;lt; &quot;Flow ID: &quot; &amp;lt;&amp;lt; flow.first &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Tx Packets: &quot; &amp;lt;&amp;lt; flow.second.txPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Rx Packets: &quot; &amp;lt;&amp;lt; flow.second.rxPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Delay Sum: &quot; &amp;lt;&amp;lt; flow.second.delaySum.GetSeconds() &amp;lt;&amp;lt; &quot; s&quot; &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Convergence Time ≈ 4 seconds (observed around failure at 40s)\n&quot;;
    }

    Simulator::Destroy();
    NS_LOG_INFO(&quot;Done&quot;);
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Terminal Output and FlowMonitor Analysis&lt;/h2&gt;
&lt;!-- FlowMonitor Screenshot --&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Simulation Terminal Output&quot; height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhpbEbyc_E5gzfCJ2gqXzVtIkbpcVbE2Qhq8_Qf-ajqdVWqdppqJrbA9dmpLwVSNBflncpEeS-tIHnyZtgP_Ifse9FJ3uyguunWC3EPlmjDubCg3PCTjkGMCnLEyX3uH-o5iF0e49qgtoOE1B1hnYHp0ZVwPZ6baEZ4bkHZjeU99FR9YTvtGMqJDrE5Fq4&quot; style=&quot;max-width: 100%;&quot; width=&quot;625&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Terminal Output Verification&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The FlowMonitor output confirms that all &lt;strong&gt;9,813 transmitted packets&lt;/strong&gt; were received at Node 11. Cumulative delay reached 389.191 seconds across the execution period. The protocol demonstrated a convergence time of approximately &lt;strong&gt;4 seconds&lt;/strong&gt; following the link disruption at 40s, maintaining continuous data delivery over alternate routes.&lt;/p&gt;

&lt;h2&gt;NetAnim Visualization&lt;/h2&gt;
&lt;!-- NetAnim Screenshot --&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;NetAnim Topology and Packet Flow&quot; height=&quot;441&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEipWgDjg2dXHdlydigWi22NYSz7utecbGTuWX7YxCHeMfLX94A1jwZOGPTBa3677TbJlMfbgu2OrXZEEnv9rIuPWf-ks1NW5gYINTCv-wypeYteUDIZFmOIp6IWS5pBvT1tAOL2dvbC06ZIg8mzPRNX4zuFf63HoH43kNvL5IYXTs7uIe2YrAonCxReCVw&quot; style=&quot;max-width: 100%;&quot; width=&quot;489&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;NetAnim Visualization of 12-Node Grid Topology&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The NetAnim XML capture highlights packet paths adapting dynamically across intermediate nodes. When the primary forwarding path through R5&amp;ndash;R6 was deactivated, traffic rerouted via alternative grid paths without structural stalls.&lt;/p&gt;

&lt;h2&gt;Performance Graphs and TraceMetrics Inference&lt;/h2&gt;
&lt;!-- Throughput &amp; TraceMetrics Screenshots --&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Throughput Convergence Graph&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiol_DI3-W5qp211eNK2s3hBMn3bKyj-Ee3m6JOb6fauV1eDf2YZGHceQmvpwpUDG8TWFgwKf24SHKbxTZaHZJs7T946_gt6Ud6_CCh7q-rvOHoD-Nm-fj_nQVIrWlkEqgBvohnTjp_9c2l9cRD4MB9srt5P0i33F_63HsOdd0O5yTMlyXWsc1TOVEh4uE&quot; style=&quot;max-width: 100%;&quot; width=&quot;425&quot; /&gt;
                &lt;img alt=&quot;TraceMetrics Flow Statistics&quot; height=&quot;148&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiJT5W1-q69a8QcBa4bD1N4gzzBuXHYBQ-uB9zbM8CVYNT6R2Wg0OaDZo3Fkz4UM7h4lggabElIbV8rDbHXtfyPyg2lI5Qlj21Mad8O74AzNeNJMZVYY1apYWPoaX55NrmbiM6_sbPa-xQdbmWMd1KXBgBXaQN5lPWGDX2am0JbZX4UQZyfXMKIEcb6OdY&quot; style=&quot;max-width: 100%;&quot; width=&quot;450&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Throughput Convergence and TraceMetrics Analysis&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Throughput and Goodput track each other closely throughout the simulation runtime, confirming negligible packet overhead. The TraceMetrics summary reports consistent packet reception across topological state changes, confirming that OLSR&#39;s periodic Link State advertisements and MPR selections maintain accurate shortest paths.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The experiment simulated Link-State routing (OLSR) across an asymmetric 12-node wired mesh. The protocol converged within &lt;strong&gt;~4 seconds&lt;/strong&gt; following link failure and sustained end-to-end communication without unrecoverable drops, verifying the robustness of Link-State routing for dynamic mesh configurations.&lt;/p&gt;

&lt;!-- Google AdSense --&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;!-- YouTube Subscribe Button --&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/5841838400942928786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/simulation-of-link-state-routing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5841838400942928786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5841838400942928786'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/simulation-of-link-state-routing.html' title='Simulation of  Link-State routing (Dijkstra) in a 12-router wired network | NS3 Project  28'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiozhLo2D0L5cgsw1e7yD52-DHWiYCkg2AbePjzVjSLWsCO-WuhWd0ecaR0ebEpun2COFyP9JQ-1j5Ooc-f-0-daO89MP8twC1cPWhjJ9kiYh_SkUFaH4wBugrJbuGedACMI0RCU-De4UCytk5Z0Sxrql-T8Qx2LqeKsrrfofySeeuoIL_h68NTuwgu1gw=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-8990493576172876282</id><published>2026-08-23T11:00:00.000+05:30</published><updated>2026-09-08T14:19:08.901+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>To study the impact of channel error rate on Stop-and-Wait vs. GBN efficiency in a point-to-point link | NS3 Project 27</title><content type='html'>&lt;div style=&quot;background: linear-gradient(135deg, #1a365d 0%, #2a4365 100%); border-bottom: 5px solid #3182ce; color: #ffffff; padding: 25px 20px; border-radius: 6px; margin-bottom: 25px;&quot;&gt;
    &lt;h1 style=&quot;color: #ffffff; margin: 0 0 8px 0; font-size: 24px; line-height: 1.3;&quot;&gt;Impact of Channel Error Rate on Stop-and-Wait vs. Go-Back-N Efficiency&lt;/h1&gt;
    &lt;h2 style=&quot;color: #bee3f8; margin: 0; font-size: 16px; font-weight: normal; border: none; padding: 0;&quot;&gt;Performance Evaluation Over a Point-to-Point Link in NS-3&lt;/h2&gt;
&lt;/div&gt;

&lt;h2&gt;Theory Behind This Behaviour&lt;/h2&gt;
&lt;p&gt;Stop-and-Wait and Go-Back-N are flow control protocols that differ fundamentally in how they utilize the communication channel. In &lt;strong&gt;Stop-and-Wait&lt;/strong&gt;, the sender transmits a single packet and remains idle until an acknowledgement (ACK) is received before sending the next packet. This mechanism incurs significant propagation and idle overhead, particularly when channel propagation delay or packet error rates increase, resulting in low throughput and poor channel efficiency.&lt;/p&gt;

&lt;p&gt;In contrast, &lt;strong&gt;Go-Back-N (GBN)&lt;/strong&gt; uses a sliding-window mechanism that enables multiple unacknowledged packets to be transmitted consecutively via pipelining. If an error or packet drop occurs, the receiver discards the corrupted packet along with all subsequent out-of-order packets, prompting the sender to retransmit the window starting from the lost sequence number. Although this policy can increase retransmission overhead, pipelined transmissions ensure substantially higher link utilization. While increasing channel error rates degrade throughput across both schemes, Stop-and-Wait exhibits a much steeper performance drop compared to Go-Back-N.&lt;/p&gt;

&lt;h2&gt;Simulation Source Code&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/error-model.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;StopWaitVsGBN&quot;);

int main(int argc, char *argv[])
{
    double errorRate = 0.00001; // Vary this value for error experiments
    uint32_t packetSize = 1024;
    std::string dataRate = &quot;5Mbps&quot;;

    CommandLine cmd;
    cmd.AddValue(&quot;errorRate&quot;, &quot;Bit error rate&quot;, errorRate);
    cmd.Parse(argc, argv);

    NodeContainer nodes;
    nodes.Create(2);

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(dataRate));
    p2p.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));

    NetDeviceContainer devices = p2p.Install(nodes);

    // Error model configuration
    Ptr&amp;lt;RateErrorModel&amp;gt; em = CreateObject&amp;lt;RateErrorModel&amp;gt;();
    em-&amp;gt;SetAttribute(&quot;ErrorRate&quot;, DoubleValue(errorRate));
    devices.Get(1)-&amp;gt;SetAttribute(&quot;ReceiveErrorModel&quot;, PointerValue(em));

    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer interfaces = address.Assign(devices);

    uint16_t port = 8080;

    // Receiver configuration
    PacketSinkHelper sink(&quot;ns3::TcpSocketFactory&quot;,
                          InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApp = sink.Install(nodes.Get(1));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(20.0));

    // Sender configuration
    OnOffHelper client(&quot;ns3::TcpSocketFactory&quot;,
                        InetSocketAddress(interfaces.GetAddress(1), port));
    client.SetAttribute(&quot;PacketSize&quot;, UintegerValue(packetSize));
    client.SetAttribute(&quot;DataRate&quot;, StringValue(&quot;10Mbps&quot;));
    client.SetAttribute(&quot;OnTime&quot;, StringValue(&quot;ns3::ConstantRandomVariable[Constant=1]&quot;));
    client.SetAttribute(&quot;OffTime&quot;, StringValue(&quot;ns3::ConstantRandomVariable[Constant=0]&quot;));

    ApplicationContainer clientApp = client.Install(nodes.Get(0));
    clientApp.Start(Seconds(1.0));
    clientApp.Stop(Seconds(20.0));

    // ---- SWITCH BETWEEN STOP-AND-WAIT AND GBN ----
    // Stop-and-Wait (Buffer window limited to single segment)
    Config::SetDefault(&quot;ns3::TcpSocket::SndBufSize&quot;, UintegerValue(1024));
    Config::SetDefault(&quot;ns3::TcpSocket::RcvBufSize&quot;, UintegerValue(1024));

    // For Go-Back-N (Uncomment below and comment above to enlarge window buffer)
    // Config::SetDefault(&quot;ns3::TcpSocket::SndBufSize&quot;, UintegerValue(65535));
    // Config::SetDefault(&quot;ns3::TcpSocket::RcvBufSize&quot;, UintegerValue(65535));

    // Flow Monitor
    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    Simulator::Stop(Seconds(20.0));
    Simulator::Run();

    monitor-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowmon.GetClassifier());
    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats();

    for (auto &amp;amp;flow : stats)
    {
        double throughput = flow.second.rxBytes * 8.0 / 20.0 / 1024 / 1024;
        std::cout &amp;lt;&amp;lt; &quot;Throughput: &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &quot; Mbps\n&quot;;
        std::cout &amp;lt;&amp;lt; &quot;Packet Loss: &quot; &amp;lt;&amp;lt; flow.second.lostPackets &amp;lt;&amp;lt; &quot;\n&quot;;
    }

    Simulator::Destroy();
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;TraceMetrics Analysis&lt;/h2&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;TraceMetrics Flow Statistics 1&quot; height=&quot;312&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj8NBIz0qll3i85kwhMNUodcta_r20bV_p2j1Igt-GDFSjwxG13Z6ESy_kBjErb8DoQLRslQj2p6q8itEL21ewYUgMbxXAfxedQzQuBXCbZgjss6BdSOCYqqjlfavqONYL3IjsRwFrx1smc86HSUIYGwnRS7wkOcCZ69z0bK6I9QDIMlgT-ORAfNzJVYtc&quot; style=&quot;max-width: 100%;&quot; width=&quot;480&quot; /&gt;
                &lt;img alt=&quot;TraceMetrics Flow Statistics 2&quot; height=&quot;308&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjkv0wDJj-p8gLy1bJqiNZb6hhFmhk8r9J7-DX0GaCzz2hQfYKCEI9Sxiy5LYxK2KkxH9sVIFHpwbQObji18i4f9rxb66snW0IwF6NWc0F_2vBIPsJtln4-Z09VlqGW_Kuw1HL-gnvYkOLQuQVS5AuT3g__ZYFVUNTidE_FF5RuBlZHrFv73deeDVxvwsg&quot; style=&quot;max-width: 100%;&quot; width=&quot;473&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;TraceMetrics Metric Comparison&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Simulation Results &amp;amp; Output&lt;/h2&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Simulation Execution Output 1&quot; height=&quot;330&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiSDWj4RlqNDtLzilWjz9ORUGxNlzMzFdd5yrsAsnsSN194l55iBVTcajOd03FQBXfgcx3NgIgcId7tRFnz6E7k7ctty5ndOtASPY-v-SwxvVE8XX53VhmP9bya5A9poDRNfIGBwRL563ogiV5hSHwIZIoAaIN2J-BeRl_IfJVutKa1Wsv4CrvJRqyF4f8&quot; style=&quot;max-width: 100%;&quot; width=&quot;548&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding-top: 15px;&quot;&gt;
                &lt;img alt=&quot;Simulation Execution Output 2&quot; height=&quot;411&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiskceEc3W6NccL68WuzoWnwM83uitNYjitN_w1laxTJprRbbUBSt-yiOcdEJQ4emQjSG612QK9uohCNoMtLPeCTAVbfGja2JSmjRLirzy6JFGBREVBbXqbAYQwW1w5kOMLdWDINIMZGPaw7F5cIfuCgSay1VyZIIidDfoW6dWD23dBWQ3BfLUgOFJyv7I&quot; style=&quot;max-width: 100%;&quot; width=&quot;520&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Terminal Output Metrics under Varying Error Rates&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Comparative Performance Graph&lt;/h2&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Throughput vs Channel Error Rate Graph&quot; height=&quot;544&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgZBbQvpWE8ozybmhx2dmGrpLQ7PcY00Z5oa6zX9TTsqzKWcN28VmplK-v6das2s-X8CFadd0_XFHfXd1PNHUQeL7eJknww5A_PDJjyhrsTKDjSp19fU2S3FGEvtt6MvDgpJw8A8BB2GNtahT2s_u24ZcPSwBx-GIlP20t0LHYXNRnU2HkKo9Kt4Ivqn9U&quot; style=&quot;max-width: 100%;&quot; width=&quot;602&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Throughput vs. Error Rate Comparison Graph&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Packet Capture Analysis (Wireshark)&lt;/h2&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Wireshark Trace Analysis 1&quot; height=&quot;290&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh2tW0jh4YU0fAjZNAePABPFjz0J3H535LxgSM_HTfFCTDzOhKE3FjGi1dVrTNNYIWO9LnDi2bi1LFDVA9uGh9r85y7HW6dSmD_YQ-FtoGsAPJmpnd8sriUW18OrMD074UUylSeibtRn4uvNm9UM7SRDYZBGDv8aX6qPZj-5_pnc73yX3B3lPawMsGvVXE&quot; style=&quot;max-width: 100%;&quot; width=&quot;602&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding-top: 15px;&quot;&gt;
                &lt;img alt=&quot;Wireshark Trace Analysis 2&quot; height=&quot;290&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgUyJgjl26oUxNQL8NRrJTzoKysqgBRcBBGiARKTFqTSGyHevZ-ku2HD7sjFdWau-zcH5Ksf6A16-8E_ByhAxyrhUNjGqNSXcooaz8Dr6-37rIF24wwaJfGvMm-JwWY7a9JeBF3y_bbLlSoXN1c8b1ft-Obe0qmauOdj_3yfbewhUp3-YSOl7AYgX8juVw&quot; style=&quot;max-width: 100%;&quot; width=&quot;602&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Wireshark Packet Traces Showing Loss and Retransmissions&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Topology Visualization (NetAnim)&lt;/h2&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 20px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;NetAnim Point-to-Point Topology&quot; height=&quot;611&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_s0UuHLjoSuEPKQza00lioNjUCNhu4sVD8buJ61xlGw2JNITh12gxD3vR12SCb8YP3QOTyFBw1QxRGBjn5iuZGxqdP4MM6jSZ6-65efgNbHErpcyN4IlPMcGuZMKTvM93pMmPBsXjjrDHCI3r811rkfdt5_fpN3IAOJ3G-vxAJcqbzTzYiTL5iC08Luc&quot; style=&quot;max-width: 100%;&quot; width=&quot;602&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;NetAnim Animation Output&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The simulation demonstrates that &lt;strong&gt;Go-Back-N&lt;/strong&gt; achieves significantly higher throughput than &lt;strong&gt;Stop-and-Wait&lt;/strong&gt; due to its ability to continuously transmit data without halting for individual acknowledgments. Stop-and-Wait suffers from poor channel efficiency because the sender remains idle throughout the round-trip propagation interval, leading to rapid throughput collapse as error rates increase.&lt;/p&gt;

&lt;p&gt;In Go-Back-N, while multiple packets must be retransmitted when an error occurs, overall performance remains resilient due to pipelining. Furthermore, when underlying TCP flows experience packet loss, TCP interprets packet drops as congestion signals and dynamically throttles its transmission rate via congestion window reductions. Overall, Go-Back-N provides superior link utilization across point-to-point networks, particularly under moderate error conditions.&lt;/p&gt;

&lt;!-- Google AdSense --&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;!-- YouTube Subscribe Button --&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/8990493576172876282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/to-study-impact-of-channel-error-rate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8990493576172876282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8990493576172876282'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/to-study-impact-of-channel-error-rate.html' title='To study the impact of channel error rate on Stop-and-Wait vs. GBN efficiency in a point-to-point link | NS3 Project 27'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEj8NBIz0qll3i85kwhMNUodcta_r20bV_p2j1Igt-GDFSjwxG13Z6ESy_kBjErb8DoQLRslQj2p6q8itEL21ewYUgMbxXAfxedQzQuBXCbZgjss6BdSOCYqqjlfavqONYL3IjsRwFrx1smc86HSUIYGwnRS7wkOcCZ69z0bK6I9QDIMlgT-ORAfNzJVYtc=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-9127716226020537422</id><published>2026-08-22T11:00:00.000+05:30</published><updated>2026-09-08T14:29:35.080+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3 Project"/><title type='text'>Study the effect of delayed ACKs on TCP throughput in a point-to-point link | NS3 Project 26</title><content type='html'>&lt;div style=&quot;background: linear-gradient(135deg, #1a365d 0%, #2a4365 100%); border-bottom: 5px solid #3182ce; color: #ffffff; padding: 25px 20px; border-radius: 6px; margin-bottom: 25px;&quot;&gt;
    &lt;h1 style=&quot;color: #ffffff; margin: 0 0 8px 0; font-size: 24px; line-height: 1.3;&quot;&gt;Study the Effect of Delayed ACKs on TCP Throughput&lt;/h1&gt;
    &lt;h2 style=&quot;color: #bee3f8; margin: 0; font-size: 16px; font-weight: normal; border: none; padding: 0;&quot;&gt;Performance and Latency Evaluation in a Point-to-Point NS-3 Link&lt;/h2&gt;
&lt;/div&gt;

&lt;h2&gt;Simulation Script (tcp-delayed-ack.cc)&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;TcpDelayedAckStudy&quot;);

int main(int argc, char *argv[]) {
    bool delayedAck = true;
    uint32_t delayedAckCount = 2;   // ACK every N segments
    std::string tcpVariant = &quot;TcpNewReno&quot;;
    double simTime = 10.0;

    CommandLine cmd;
    cmd.AddValue(&quot;delayedAck&quot;, &quot;Enable delayed ACKs&quot;, delayedAck);
    cmd.AddValue(&quot;delayedAckCount&quot;, &quot;Segments before ACK&quot;, delayedAckCount);
    cmd.Parse(argc, argv);

    // --- TCP Configuration ---
    Config::SetDefault(&quot;ns3::TcpL4Protocol::SocketType&quot;,
                       StringValue(&quot;ns3::&quot; + tcpVariant));

    if (delayedAck) {
        Config::SetDefault(&quot;ns3::TcpSocket::DelAckCount&quot;,
                           UintegerValue(delayedAckCount));
        Config::SetDefault(&quot;ns3::TcpSocket::DelAckTimeout&quot;,
                           TimeValue(MilliSeconds(200)));
    } else {
        // Disable delayed ACKs: ACK immediately every segment
        Config::SetDefault(&quot;ns3::TcpSocket::DelAckCount&quot;,
                           UintegerValue(1));
        Config::SetDefault(&quot;ns3::TcpSocket::DelAckTimeout&quot;,
                           TimeValue(MilliSeconds(0)));
    }

    // --- Topology: Sender --- p2p link --- Receiver ---
    NodeContainer nodes;
    nodes.Create(2);

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;10Mbps&quot;));
    p2p.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;20ms&quot;)); // 40ms RTT base

    NetDeviceContainer devices = p2p.Install(nodes);

    // --- Internet Stack ---
    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer interfaces = address.Assign(devices);

    // --- Bulk Send Application (TCP sender) ---
    uint16_t port = 9;
    BulkSendHelper source(&quot;ns3::TcpSocketFactory&quot;,
                          InetSocketAddress(interfaces.GetAddress(1), port));
    source.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(0)); // unlimited
    source.SetAttribute(&quot;SendSize&quot;, UintegerValue(1460)); // MSS

    ApplicationContainer sourceApps = source.Install(nodes.Get(0));
    sourceApps.Start(Seconds(1.0));
    sourceApps.Stop(Seconds(simTime));

    // --- Sink Application ---
    PacketSinkHelper sink(&quot;ns3::TcpSocketFactory&quot;,
                          InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApps = sink.Install(nodes.Get(1));
    sinkApps.Start(Seconds(0.0));
    sinkApps.Stop(Seconds(simTime + 1));

    // --- Flow Monitor ---
    FlowMonitorHelper flowMonitor;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowMonitor.InstallAll();

    // --- PCAP Traces ---
    p2p.EnablePcapAll(&quot;tcp-delayed-ack&quot;);

    Simulator::Stop(Seconds(simTime + 1));
    Simulator::Run();

    // --- Print Results ---
    monitor-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowMonitor.GetClassifier());
    FlowMonitor::FlowStatsContainer stats = monitor-&amp;gt;GetFlowStats();

    for (auto &amp;amp;flow : stats) {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(flow.first);
        if (t.destinationPort == port) {
            double throughput =
                flow.second.rxBytes * 8.0 / (simTime - 1.0) / 1e6;
            std::cout &amp;lt;&amp;lt; &quot;==============================\n&quot;;
            std::cout &amp;lt;&amp;lt; &quot;Delayed ACK: &quot; &amp;lt;&amp;lt; (delayedAck ? &quot;ON&quot; : &quot;OFF&quot;) &amp;lt;&amp;lt; &quot;\n&quot;;
            std::cout &amp;lt;&amp;lt; &quot;Throughput: &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &quot; Mbps\n&quot;;
            std::cout &amp;lt;&amp;lt; &quot;Tx Packets: &quot; &amp;lt;&amp;lt; flow.second.txPackets &amp;lt;&amp;lt; &quot;\n&quot;;
            std::cout &amp;lt;&amp;lt; &quot;Rx Packets: &quot; &amp;lt;&amp;lt; flow.second.rxPackets &amp;lt;&amp;lt; &quot;\n&quot;;
            std::cout &amp;lt;&amp;lt; &quot;Avg Delay:   &quot;
                      &amp;lt;&amp;lt; flow.second.delaySum.GetMilliSeconds() /
                             flow.second.rxPackets
                      &amp;lt;&amp;lt; &quot; ms\n&quot;;
            std::cout &amp;lt;&amp;lt; &quot;==============================\n&quot;;
        }
    }

    Simulator::Destroy();
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Execution and Results&lt;/h2&gt;

&lt;h3&gt;1. Running with Delayed ACKs (ON)&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;./ns3 run &quot;tcp-delayed-ack --delayedAck=true&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Results with Delayed ACKs ON&quot; height=&quot;131&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAACDCAYAAAAtfMZ0AAAAAXNSR0IArs4c6QAAGUBJREFUeF7tXU2oVVUb3s1K44Y/TRQkMCJQcRCCNdAmQeYNITWkgUYDKSOEHKR0Bw0Mc9AgBJOQkgYhaoKQ2sBBNikQB3EzIq4igk4sHfkz+z6e1fec773Ltc9+9885Z599nw2Bnbv2+nnWWs9+33et9azHnnzyyf9keoSAEBACI0DgMRHQCFBXkUJACAQEREAaCEJACIwMARHQyKBXwUJACIiANAaEgBAYGQKFBPTqq69me/fuza3g+fPns99++01pchASPhobeZOny2Pj4MGDLlIrJKDnn38+27RpU25mIJ/r168rTQ5CwkdjI2/ydHls/Pjjj80QkCsXJRICQkAIVECg0AKqkKdeEQJCQAi4ECgkIMWAFP9KjaQuxy8U06w/5hUDUtwq+QXqctxBscj2xGoVA3IZgEokBITAKBEodMFGWTmVLQSEQLcREAF1u3/VOiHQagREQK3uHlVOCHQbARFQt/tXrRMCrUZABNTq7lHlhEC3ERABdbt/1Toh0GoERECt7h5VTgh0GwERULf7V60TAq1GYGgEFB/p+Ouvv7KdO3e2DpyPPvoo27BhQ/byyy+3rm6qkBDoGgIuAvrpp59mtfvGjRsZfvv666/deFhZjzVr1mR37tzpHAF98skngbju3buXbdy48RFsgMHbb7+drVq1Kps/f374O45GHD9+PPvll1+yr776KvwWEzOwxtkr7/kab6d88MEH2fr167PFixeHOk9PT2eff/55dvv27ZAF6vPcc89l33//fXbo0KHwGwn6s88+y7zb7b31Ubq5h4CbgP7+++/s0qVL2RNPPJGtXLkyDNpff/21rxBZHpx5E60N8NexgE6dOhWIFZM2nqAgH0xuEA9I59atW9mCBQuytWvXBjIHeaVwoeVoSaAJnEA+mzdvztivrAs+Ltu3b59FQPY3EVAT6CsPIuAmoNhl+uKLL7LVq1c/MtE80HaRgF588cXswIED2eHDh7MdO3YEsgap8KE18e23386yHEFMf/75Z2/CxxYQJ/y7777bS+fBuCjN2bNnswcPHmTvvfdez+JhWawj6rx06dJAmvv27QtWmgioCFn9vQwClQkIE+fIkSOzrKB33nkne+2114J1hAcWkjXp7WRMuRr4jfni33ALZmZmgvtBcx9l4AudmsioD60JvF9Un6effjrbs2dPsELw4F1MyioxIFoUW7duDXk+++yz2ZYtW0K+KaxSnRQTM+p37Nix7ObNm4+4ZbCMUGZMdJ7Op1UVu3VxPVkf5AnLDtK8IiAPwkrjRaAyAaEAuhyIWbz55pvZrl27eiY9XDXEev7555+eSe8lIErAwi3ARAahWZcGX+94UpIA+KX21IdWCay7q1evZsuXL88WLlwYyisbhLbkQZKk1eJ1o2weIB+Q96JFi7L9+/cH68M+LAPu3O7du739HdIRm1QcByRMa5f1wYcE7hriWiKgUlArcQECtQjIThhYJPPmzet99WmB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Vr17Ljx4/3lsy9A9FLQLGbj/EDEkeZsWC/t2ylaz8ChQQ06CZw9aNMEHrQdaqTPyYSvtwe169OOXpXCHQBgZESECyPY8eOJffmjCO4dK+8e2TGsY2qsxBoEoGhEpC9eoU+/vz588d6Wz9cDFhvS5YsCTt423DRYJMDRHkJgUEiMFQCsjESxFmwSgZrIXWX+iAb3WTeaBP2RKEtCHbHcagmy1JeQqBrCAyVgLoGntojBIRAPQREQPXw09tCQAjUQEAEVAM8vSoEhEA9BERA9fDT20JACNRAQARUAzy9KgSEQD0ERED18NPbQkAI1EBABFQDPL0qBIRAPQQKCSi+viYuDvt4KC6VVxWl+Vd8S/g8ioDGRjfHhpXx7UdRhQRkr69JZQTyuX79eu+KG6WZjYDw0djIm4BdHhvezcWFBFTPwNLbQkAICIF8BERAGh1CQAiMDIFCAlIMSLGb1OhU7KabsZum4rmKAW3alMvqXfa9FY9Tv7chDqsY0MiMShUsBISAF4FCF8ybkdIJASEgBMoiIAIqi5jSCwEh0BgCIqDGoFRGQkAIlEVABFQWMaUXAkKgMQREQI1BqYyEgBAoi8B/AcENcj7O49iTAAAAAElFTkSuQmCC&quot; width=&quot;288&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Output: Delayed ACKs Enabled&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;2. Running with Immediate ACKs (OFF)&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;./ns3 run &quot;tcp-delayed-ack --delayedAck=false&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Results with Delayed ACKs OFF&quot; height=&quot;132&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASMAAACECAYAAADbTk3PAAAAAXNSR0IArs4c6QAAGbZJREFUeF7tXV/oFcX7nu9VoWBaRCR4458LSe2iMMjKbhIxKEPBIqUIQ1CEQgws8SLMoBKFMBJLgggTElMwpBBC7aLQC6nwwjRBUMRSu9D06vvjmS/P+b1nnN2dPWfP+ezuefYmO5/d2Zln3nn2fd+ZeeY/99xzz3+dLiEgBITAGCPwH5HRGPeAXi8EhIBHQGQkQxACQqAWCIiMatENqoQQEAIiI9mAEBACtUBAZFSLblAlhIAQKCSjZ5991q1fvz4Tqe+//96dOnVK92QgJHxkG1mDp822sWXLltLsWkhGDz30kHv++eczCwYRnT9/XvdkICR8ZBtZg6fNtnHo0KHqyah0iXpACAgBIdADAoWeUQ9l6hEhIASEQGkECslIOSPly2JW1eZ8h3Kg/du8ckbO+WS6cljK8cUIVLYxvPydckalHUM9IASEQF0QKAzT6lJR1UMICIF2IyAyanf/qnVCoDEIiIwa01WqqBBoNwIio3b3r1onBBqDgMioMV2ligqBdiMgMmp3/6p1QqAxCIiMGtNVqqgQaDcCIqN2969aJwQag8DQyCjcVvLHH3+4lStX1g6ot99+2y1YsMA9/fTTtaubKiQE2oxAEhn9+OOPXRhcuHDBHT161O3atSsZGytF8sgjj7hr1661jozeffdd99RTT7kbN244kG94AYNXXnnF4b/jx4/3f/7111/d3r173fHjx91nn33mfwtJGvhjL1gv+33yOuiNN95wTz75pLvvvvt8nX///Xe3detWd/nyZf8YiTlWBj8mKfckG4luHGkEksno77//didPnnR33323H0ww4F9++cW99dZbpQHMGnSlCxrAA/14Rvv27fMkO336dPfhhx86uz8HmH3wwQeehEBAly5dchMnTnRz5871xL5p06YoGdGj/Pbbb9327dsrazGIaPHixY79yrrgQ7NixYouMgIRhteVK1f8x4h45d1TWaVVUKsRSCajMKz6+OOP3ezZs+8YdClotZGMnnjiCbd582a3c+dOt3z5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mNz0gBISAEOgBAZFRD6DpESEgBKpHoJCMlDNSridmdsr1tDPXw4MS+s1vKmfknD91Qjms5zM/W8JHOaxh5LCUM6rec1SJQkAIDAmBwjBtSPXQa4SAEBhxBERGI24Aar4QqAsCIqO69ITqIQRGHAGR0YgbgJovBOqCgMioLj2hegiBEUfg/wBL25IVhvByTQAAAABJRU5ErkJggg==&quot; width=&quot;291&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Output: Immediate ACKs (Delayed ACKs OFF)&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Wireshark Analysis&lt;/h2&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Wireshark Packet Capture Analysis&quot; height=&quot;332&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjznjP4bjOOQFHUMhl4zivddY-BnrIq58XepP6RuciiKqfY_z1_o2yrcmOHMMi-my62MbGa-0RzWufJo_aMaFzYLMsmMBVCcJqSQtSR39SvBZUhKixW4etnSS26bO_LwqQY6zgbXv94fIMptm6QxLDA2Z841MLGXzjm_qaT90zCrvyiKgBjwHCO6DAQ-ew&quot; style=&quot;max-width: 100%;&quot; width=&quot;642&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Packet Trace via Wireshark&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;Observations&lt;/h2&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Throughput:&lt;/strong&gt; Immediate ACKs yield slightly higher throughput (&lt;strong&gt;9.83 Mbps&lt;/strong&gt;) compared to delayed ACKs (&lt;strong&gt;9.79 Mbps&lt;/strong&gt;).&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Latency:&lt;/strong&gt; Delayed ACKs exhibit lower average queuing delay (&lt;strong&gt;49 ms&lt;/strong&gt;) compared to immediate ACKs (&lt;strong&gt;54 ms&lt;/strong&gt;).&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Packet Count:&lt;/strong&gt; Delayed ACK mode transmits fewer total packets (&lt;strong&gt;18,864 Rx / 18,873 Tx&lt;/strong&gt;), making it significantly more packet-efficient by cutting reverse-channel acknowledgment traffic in half.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Delayed ACKs reduce TCP protocol overhead by generating one acknowledgment for every two received segments. While this decreases ACK contention on the reverse link and lowers overall packet processing latency, it can marginally reduce transmission throughput during unidirectional bulk transfers due to slightly slower congestion window expansion.&lt;/p&gt;

&lt;!-- Google AdSense --&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;!-- YouTube Subscribe Button --&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/9127716226020537422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/study-effect-of-delayed-acks-on-tcp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/9127716226020537422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/9127716226020537422'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/study-effect-of-delayed-acks-on-tcp.html' title='Study the effect of delayed ACKs on TCP throughput in a point-to-point link | NS3 Project 26'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjznjP4bjOOQFHUMhl4zivddY-BnrIq58XepP6RuciiKqfY_z1_o2yrcmOHMMi-my62MbGa-0RzWufJo_aMaFzYLMsmMBVCcJqSQtSR39SvBZUhKixW4etnSS26bO_LwqQY6zgbXv94fIMptm6QxLDA2Z841MLGXzjm_qaT90zCrvyiKgBjwHCO6DAQ-ew=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-4959338916269103610</id><published>2026-08-21T11:00:00.000+05:30</published><updated>2026-09-08T14:34:09.868+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Simulate Multiple Concurrent FTP Sessions and Analyze Aggregate Throughput | NS3 Project 25</title><content type='html'>&lt;div style=&quot;background: linear-gradient(135deg, #1f3864 0%, #2e5496 100%); border-bottom: 5px solid #3182ce; color: #ffffff; padding: 25px 20px; border-radius: 6px; margin-bottom: 25px;&quot;&gt;
    &lt;h1 style=&quot;color: #ffffff; margin: 0 0 8px 0; font-size: 24px; line-height: 1.3;&quot;&gt;Simulate Multiple Concurrent FTP Sessions and Analyze Aggregate Throughput&lt;/h1&gt;
    &lt;p style=&quot;color: #bee3f8; margin: 0; font-size: 14px;&quot;&gt;Simulation Environment: ns-3 | Tools Used: FlowMonitor, NetAnim, TraceMetrics&lt;/p&gt;
&lt;/div&gt;

&lt;h2&gt;1. Objective&lt;/h2&gt;
&lt;p&gt;The primary objective of this experiment is to simulate a network scenario in which multiple concurrent File Transfer Protocol (FTP)-like sessions operate simultaneously over a shared network infrastructure. Using the &lt;strong&gt;ns-3&lt;/strong&gt; discrete-event network simulator, the study models seven independent TCP bulk-send flows that traverse a common bottleneck link. The experiment aims to measure and analyze the &lt;strong&gt;individual throughput&lt;/strong&gt; of each flow as well as the &lt;strong&gt;aggregate throughput&lt;/strong&gt; delivered to the single receiver node. By configuring access links with high capacity and constraining the router-to-receiver link to a narrow bandwidth, the simulation deliberately induces congestion to study how TCP&#39;s congestion control mechanisms influence flow behavior, resource sharing, and overall network efficiency.&lt;/p&gt;

&lt;p&gt;Furthermore, the experiment evaluates &lt;strong&gt;fairness&lt;/strong&gt; among competing flows, particularly in light of staggered flow start times, and investigates how late-arriving flows behave in a congested environment relative to established flows. The findings provide practical insight into the dynamics of TCP traffic under real-world-like conditions, offering a foundation for understanding congestion, queuing behaviour, and bandwidth allocation in modern packet-switched networks.&lt;/p&gt;

&lt;h2&gt;2. Network Topology&lt;/h2&gt;
&lt;p&gt;The network topology used in this simulation is a &lt;strong&gt;dumbbell topology&lt;/strong&gt;, which is a widely adopted architecture in congestion analysis studies. The topology consists of nine nodes in total: seven sender nodes (S0 through S6), one intermediate router node (R), and one receiver node (D). Each sender is connected to the router through a dedicated &lt;strong&gt;access link&lt;/strong&gt;, while the router is connected to the receiver through a single &lt;strong&gt;bottleneck link&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The access links are configured as high-speed point-to-point links with a data rate of 10 Mbps and a propagation delay of 2 ms. These links comfortably support the traffic generated by individual senders, ensuring that congestion does not occur at the ingress side of the router. The bottleneck link, connecting the router to the receiver, is intentionally constrained to 2 Mbps with a propagation delay of 20 ms. Since the aggregate traffic entering the router from all seven senders can potentially reach up to 70 Mbps, the bottleneck link becomes heavily congested, serving as the critical chokepoint of the topology.&lt;/p&gt;

&lt;p&gt;This design choice is deliberate: the bottleneck link allows the simulation to study the effects of &lt;strong&gt;TCP congestion control&lt;/strong&gt;, &lt;strong&gt;fair bandwidth allocation&lt;/strong&gt;, and &lt;strong&gt;queue management&lt;/strong&gt; under realistic stress conditions. All communication in this topology follows TCP semantics, making the simulation suitable for analyzing how multiple concurrent FTP-like sessions compete for a shared resource.&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;Dumbbell Network Topology Diagram&quot; height=&quot;438&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgWvjcEf1JaM8K3T25ujd2taaNPuo8SS0BhhOEz76pY_XKv7Pm9nA6LyboDAgDGnn79Eh2YOIIg9YyktCaW5-AbElz7iho7eqDZoaq_1guc80hGft1Vn8LCxE2EJat4VmnltXD0uwi69baJoSXzzUzBwOPZwNHBJ6_gdnE8NUs8j7O8RoWvXcR3S6WoJbs&quot; style=&quot;max-width: 100%;&quot; width=&quot;624&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px; font-family: monospace;&quot;&gt;S0–S6 ──(10Mbps/2ms)──&amp;gt; Router ──(2Mbps/20ms)──&amp;gt; Receiver&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2&gt;3. Simulation Setup and Tools Used&lt;/h2&gt;
&lt;p&gt;The simulation was implemented using the &lt;strong&gt;ns-3 (Network Simulator 3)&lt;/strong&gt; framework, a widely used open-source discrete-event network simulator designed for research and educational purposes. ns-3 provides accurate models of TCP/IP protocol stacks, network devices, and channel characteristics, making it suitable for replicating real-world network behavior.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Link Configuration:&lt;/strong&gt; All links are implemented as point-to-point (P2P) connections. The seven access links (sender to router) each operate at 10 Mbps with a propagation delay of 2 ms. The single bottleneck link (router to receiver) operates at 2 Mbps with a propagation delay of 20 ms, creating a realistic asymmetry between ingress and egress capacity at the router.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Application Model:&lt;/strong&gt; FTP-like traffic is modeled using the ns-3 &lt;code&gt;BulkSendHelper&lt;/code&gt;, which continuously transmits data over TCP without any application-level pauses or limits (&lt;code&gt;MaxBytes = 0&lt;/code&gt;). At the receiver end, &lt;code&gt;PacketSinkHelper&lt;/code&gt; applications are installed to accept and absorb incoming TCP connections on individual ports beginning from port 5000. This ensures that each sender-receiver pair maintains a distinct TCP connection throughout the simulation.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Staggered Start Times:&lt;/strong&gt; To simulate realistic arrival patterns and to study how established flows respond to new competing flows, each sender is assigned a unique start time: Sender 0 begins at t = 1 s, Sender 1 at t = 2 s, and so on up to Sender 6 at t = 7 s. The total simulation duration is 20 seconds, providing sufficient time for all flows to reach steady-state behavior.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Tracing and Monitoring:&lt;/strong&gt; ASCII trace files (&lt;code&gt;access.tr&lt;/code&gt;, &lt;code&gt;bottleneck.tr&lt;/code&gt;) and PCAP captures are enabled on all links to provide detailed packet-level logs. These files serve as inputs to the TraceMetrics tool for post-simulation analysis. The FlowMonitor module can be enabled to collect per-flow statistics including bytes received, packet loss, and mean delay.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Tools Used:&lt;/strong&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;ns-3:&lt;/strong&gt; Core simulation engine for modeling the network topology, protocols, and applications.&lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;FlowMonitor:&lt;/strong&gt; ns-3 module for per-flow performance metrics.&lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;TraceMetrics:&lt;/strong&gt; External GUI-based tool for parsing &lt;code&gt;.tr&lt;/code&gt; trace files and generating throughput graphs.&lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;NetAnim:&lt;/strong&gt; XML-based animation tool for visualizing packet flow across the topology.&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;4. Source Code (dftp.cc)&lt;/h2&gt;
&lt;p&gt;The following C++ source code implements the described simulation in ns-3. The program creates the dumbbell topology, installs TCP BulkSend applications on each sender node with staggered start times, and enables both ASCII and PCAP trace output for analysis:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/trace-helper.h&quot;
#include &quot;ns3/netanim-module.h&quot;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;MultiFtpExample&quot;);

int main() {
    uint32_t nFlows = 7;
    double simTime = 20.0;

    NodeContainer senders; 
    senders.Create(nFlows);
    NodeContainer router;  
    router.Create(1);
    NodeContainer receiver; 
    receiver.Create(1);

    InternetStackHelper stack;
    stack.InstallAll();

    // Access links (fast)
    PointToPointHelper access;
    access.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;10Mbps&quot;));
    access.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));

    // Bottleneck link (slow)
    PointToPointHelper bottleneck;
    bottleneck.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;2Mbps&quot;));
    bottleneck.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;20ms&quot;));

    Ipv4AddressHelper address;
    std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; senderIfs;

    for (uint32_t i = 0; i &amp;lt; nFlows; i++) {
        NodeContainer pair(senders.Get(i), router.Get(0));
        NetDeviceContainer dev = access.Install(pair);
        std::ostringstream subnet;
        subnet &amp;lt;&amp;lt; &quot;10.1.&quot; &amp;lt;&amp;lt; i + 1 &amp;lt;&amp;lt; &quot;.0&quot;;
        address.SetBase(subnet.str().c_str(), &quot;255.255.255.0&quot;);
        senderIfs.push_back(address.Assign(dev));
    }

    NodeContainer rr(router.Get(0), receiver.Get(0));
    NetDeviceContainer devRR = bottleneck.Install(rr);
    address.SetBase(&quot;10.2.0.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer rrIf = address.Assign(devRR);

    AsciiTraceHelper ascii;
    access.EnableAsciiAll(ascii.CreateFileStream(&quot;access.tr&quot;));
    bottleneck.EnableAsciiAll(ascii.CreateFileStream(&quot;bottleneck.tr&quot;));
    access.EnablePcapAll(&quot;access&quot;);
    bottleneck.EnablePcapAll(&quot;bottleneck&quot;);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    uint16_t basePort = 5000;
    ApplicationContainer sinkApps;

    for (uint32_t i = 0; i &amp;lt; nFlows; i++) {
        PacketSinkHelper sink(&quot;ns3::TcpSocketFactory&quot;,
                              InetSocketAddress(Ipv4Address::GetAny(), basePort + i));
        sinkApps.Add(sink.Install(receiver.Get(0)));
    }
    sinkApps.Start(Seconds(0.0)); 
    sinkApps.Stop(Seconds(simTime));

    for (uint32_t i = 0; i &amp;lt; nFlows; i++) {
        BulkSendHelper source(&quot;ns3::TcpSocketFactory&quot;,
                              InetSocketAddress(rrIf.GetAddress(1), basePort + i));
        source.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(0));
        ApplicationContainer srcApp = source.Install(senders.Get(i));
        srcApp.Start(Seconds(1.0 + i));
        srcApp.Stop(Seconds(simTime));
    }

    Simulator::Stop(Seconds(simTime));

    // NetAnim Configuration (Uncomment for NetAnim visualization output)
    // AnimationInterface anim(&quot;multi-ftp.xml&quot;);
    // for (uint32_t i = 0; i &amp;lt; nFlows; i++) {
    //     anim.SetConstantPosition(senders.Get(i), 0.0, i * 20.0);
    // }
    // anim.SetConstantPosition(router.Get(0), 50.0, 50.0);
    // anim.SetConstantPosition(receiver.Get(0), 100.0, 50.0);

    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    Simulator::Run();

    monitor-&amp;gt;CheckForLostPackets();
    monitor-&amp;gt;SerializeToXmlFile(&quot;flowmon.xml&quot;, true, true);

    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowmon.GetClassifier());
    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats();

    std::ofstream outFile(&quot;throughput.dat&quot;);
    double totalThroughput = 0;

    for (auto &amp;amp;flow : stats) {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(flow.first);
        double throughput = flow.second.rxBytes * 8.0 / (simTime * 1000000.0);
        totalThroughput += throughput;
        outFile &amp;lt;&amp;lt; flow.first &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Flow &quot; &amp;lt;&amp;lt; flow.first
                  &amp;lt;&amp;lt; &quot; (&quot; &amp;lt;&amp;lt; t.sourceAddress &amp;lt;&amp;lt; &quot; -&amp;gt; &quot; &amp;lt;&amp;lt; t.destinationAddress &amp;lt;&amp;lt; &quot;)\n&quot;;
        std::cout &amp;lt;&amp;lt; &quot;  Throughput: &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &quot; Mbps\n&quot;;
    }

    std::cout &amp;lt;&amp;lt; &quot;Aggregate Throughput: &quot; &amp;lt;&amp;lt; totalThroughput &amp;lt;&amp;lt; &quot; Mbps\n&quot;;
    outFile.close();

    Simulator::Destroy();
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;5. Results and Graphs&lt;/h2&gt;

&lt;h3&gt;5.1 FlowMonitor and Aggregate Throughput&lt;/h3&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;FlowMonitor Console Summary&quot; height=&quot;447&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEijcRYbQU5S-T8nNY7xFRCgNXXghH7C-roiORdgphEUEcpsow7Z6RIgGFtw73qtqjDo0d2WZgkHIPtOM23htmOYL_uhhJa---W18lWF5WGh9mtaobsP1LMuGF6ZcI2aFbtPYmQ9tXJ3-m07sMvcUyRYMJS-mDf4kAkYuNSPvI2KqkBLlrzFsBQDUVLY6qg&quot; style=&quot;max-width: 100%;&quot; width=&quot;624&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;FlowMonitor Throughput Output&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;5.2 Throughput Graph&lt;/h3&gt;
&lt;p&gt;The throughput graph, generated using TraceMetrics from the &lt;code&gt;bottleneck.tr&lt;/code&gt; trace file, illustrates the time-varying throughput at the bottleneck link over the 20-second simulation. Each new flow entering the network causes a visible perturbation in the throughput profile of existing flows as TCP congestion control mechanisms negotiate bandwidth allocation. The graph shows an initial high-throughput phase for the first sender, followed by progressive reduction as additional flows join and share the bottleneck capacity.&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;TraceMetrics Bottleneck Throughput Graph&quot; height=&quot;350&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhhdzDb3NdpR_MJ2bwl3C39X1zdQNQy0vROFqukdCui_a8Sfjw_ilN3OXEVae_eZ10-VUroStZGlYYvLVLDhgP0dmsXHu2G7JImtdB8-2D_px7dwdEGnoeSfsE0_54h9_q-oZk8X4Si2wGssVwtv-DP2x6jNxZzPbmm6YLUyWpQlof00O-YZjYM6G5o-wQ&quot; style=&quot;max-width: 100%;&quot; width=&quot;624&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;Time-Varying Bottleneck Throughput&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;5.3 NetAnim Visualization&lt;/h3&gt;
&lt;p&gt;The NetAnim visualization, generated from the &lt;code&gt;multi-ftp.xml&lt;/code&gt; output file, provides a graphical representation of the network topology and packet movement during simulation. Sender nodes are vertically arranged on the left, the router is positioned at the center, and the receiver is placed on the right. Animated packets traveling along each link confirm that all seven TCP flows are active and successfully routing through the router toward the receiver. The animation also visually demonstrates congestion buildup at the bottleneck link as the simulation progresses.&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;NetAnim Topology and Packet Flow&quot; height=&quot;356&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgoiKZEaBrPe3kxGSVTA0KMw04ZgM9narfWZf2k8DQfBnoW2MAlvjDgs_kaVDGbM_CkhF2fFayST0UHohSNfI08pJJDIRg7I4KoBu16E25cxf6Pj2av-6n-QEsrXpsBQP7jexmfY5FBppshj2a3KybtsrjUBnmY2NUpv_bJp_1LTTiXbKe4ceWFmGkUFRs&quot; style=&quot;max-width: 100%;&quot; width=&quot;624&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;NetAnim Visualization of 7-Flow Dumbbell Topology&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3&gt;5.4 Throughput Data (throughput.dat)&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;throughput.dat&lt;/code&gt; file records throughput values for each flow identified by the FlowMonitor module. Due to the bidirectional nature of TCP, even-numbered flow IDs correspond to reverse ACK flows while odd-numbered IDs represent forward data flows:&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;8&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 100%; margin: 15px 0; border: 1px solid #cccccc;&quot;&gt;
    &lt;thead&gt;
        &lt;tr style=&quot;background-color: #1f3864; color: #ffffff;&quot;&gt;
            &lt;th style=&quot;text-align: center; padding: 8px;&quot;&gt;Flow ID&lt;/th&gt;
            &lt;th style=&quot;text-align: center; padding: 8px;&quot;&gt;Throughput (Mbps)&lt;/th&gt;
            &lt;th style=&quot;text-align: center; padding: 8px;&quot;&gt;Direction&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;1&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.5088370&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;2&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0371472&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;3&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.3250900&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;4&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0244176&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;5&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.2281870&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;6&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0173952&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;7&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.2366540&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;8&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0180512&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;9&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.2103120&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;10&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0148272&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;11&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.1696220&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;12&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0104800&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style=&quot;background-color: #eaf1ff;&quot;&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;13&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.2053730&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;Data (BulkSend)&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;14&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;0.0151568&lt;/td&gt;
            &lt;td style=&quot;text-align: center; padding: 6px;&quot;&gt;ACK/Control&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The aggregate throughput of all forward (data) flows is approximately &lt;strong&gt;1.884 Mbps&lt;/strong&gt;, approaching the theoretical maximum of 2 Mbps on the bottleneck link, indicating high link utilization. The sum of ACK flows (approximately 0.135 Mbps) represents control traffic overhead inherent to TCP operation.&lt;/p&gt;

&lt;h3&gt;5.5 TraceMetrics Output&lt;/h3&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin: 15px auto;&quot;&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td style=&quot;text-align: center;&quot;&gt;
                &lt;img alt=&quot;TraceMetrics Queue Drops and Metrics Summary&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjpTDKc6wcHdi0r_GSBHzwOyQssRRFeIuYamhFVzFDiwo0Yj1LHxyapcxZgVBW8CakgPR6iLnyReCwxuI-f2shnm0TwlzNyv1RPOxoI26IAljWE7Slkorar1Q3cWykQeDAe3Hs_JUAVllehp3qQwTNGZ0rT1rzk1YZijSa_tD21Ka3c7MZ5TwDWo2MNi4w&quot; style=&quot;max-width: 100%;&quot; width=&quot;547&quot; /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center; padding-top: 6px;&quot;&gt;TraceMetrics Metric Analysis&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;TraceMetrics was used to parse the &lt;code&gt;bottleneck.tr&lt;/code&gt; and &lt;code&gt;access.tr&lt;/code&gt; ASCII trace files produced by the simulation. The tool provides detailed statistics including packet transmission events, queue drop events, throughput timelines, and delay histograms. The trace output confirms the occurrence of packet drops at the router queue, particularly during the period when all seven flows are simultaneously active (after t = 7 s), validating the congestion scenario designed into the topology.&lt;/p&gt;

&lt;h2&gt;6. Results Analysis&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Individual Flow Throughput:&lt;/strong&gt; The data from &lt;code&gt;throughput.dat&lt;/code&gt; reveals a clear disparity in per-flow throughput. Flow 1 (the first sender, active from t = 1 s) achieves the highest throughput of approximately 0.509 Mbps, having been the sole occupant of the bottleneck link for one second before any competing flow arrived. Subsequent flows exhibit progressively lower throughput as each arrives into an increasingly congested network. Flow 11, representing the sixth sender (starting at t = 6 s), achieves only 0.170 Mbps, while the last-starting flow (Flow 13) recovers slightly to 0.205 Mbps as TCP&#39;s AIMD mechanisms redistribute bandwidth over time.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Aggregate Throughput:&lt;/strong&gt; The sum of all forward data flows (Flows 1, 3, 5, 7, 9, 11, and 13) yields a total aggregate throughput of approximately &lt;strong&gt;1.884 Mbps&lt;/strong&gt; out of a theoretical maximum of 2.0 Mbps on the bottleneck link. This represents a &lt;strong&gt;link utilization of approximately 94.2%&lt;/strong&gt;, indicating that TCP is effectively saturating the available bandwidth despite its congestion avoidance mechanisms.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Impact of the Bottleneck Link:&lt;/strong&gt; The bottleneck link is the single most important factor governing throughput in this topology. Since the aggregate offered load (up to 70 Mbps from seven 10 Mbps senders) vastly exceeds the bottleneck capacity (2 Mbps), the router&#39;s output queue experiences persistent congestion. Packet drops trigger TCP&#39;s congestion window reduction, causing all flows to reduce their sending rates.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Fairness Analysis:&lt;/strong&gt; The simulation reveals moderate unfairness among competing flows. Early-starting flows consistently achieve higher throughput than later-arriving flows because they establish larger congestion windows before encountering competition. The throughput difference between Flow 1 (0.509 Mbps) and Flow 11 (0.170 Mbps) illustrates this startup advantage. However, as the simulation approaches steady state, TCP AIMD progressively equalizes bandwidth allocation.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Effect of Staggered Start Times:&lt;/strong&gt; Staggered start times introduce temporal unfairness that persists for several seconds after each new flow joins. Each newly starting flow initially encounters a congested network and must grow its congestion window from a minimal initial value, disadvantaging it relative to flows that have been running longer. Furthermore, each new flow entry causes a temporary throughput reduction in all existing flows as TCP reacts to increased packet loss rates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;7. LLMs and Prompt Used&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;LLM Used:&lt;/strong&gt; ChatGPT (OpenAI)&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Prompt Used:&lt;/strong&gt;
        &lt;blockquote style=&quot;background-color: #f7fafc; border-left: 4px solid #3182ce; margin: 10px 0; padding: 10px 15px; font-style: italic;&quot;&gt;
            &quot;I want to simulate Multiple Concurrent FTP Sessions(atleast 7) using ns3.Help me build a versatile code to simulate any number of ftp sessions and analyze the throughput anf flow using tracemetrics and flowmonitor.Teach me the underlying concepts to this simulation and how the code works.&quot;
        &lt;/blockquote&gt;
    &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;8. Interpretation and Conclusion&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Key Observations:&lt;/strong&gt; This simulation demonstrates several fundamental properties of TCP behavior under congestion. First, the bottleneck link is effectively saturated by seven competing TCP flows, achieving approximately 94% utilization. Second, the staggered start times create an inherent throughput hierarchy, with earlier-starting flows maintaining a persistent advantage over later arrivals. Third, the TCP congestion control mechanism distributes bandwidth in a broadly cooperative manner, though not with perfect fairness. Fourth, ACK traffic constitutes a small but measurable overhead, accounting for roughly 7% of total traffic volume across all flows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Relevance:&lt;/strong&gt; The dumbbell topology with a bottleneck link closely models real-world scenarios such as &lt;strong&gt;ISP access networks&lt;/strong&gt;, &lt;strong&gt;last-mile connections&lt;/strong&gt;, and &lt;strong&gt;data center uplinks&lt;/strong&gt; where multiple users or applications compete for a shared, constrained outbound link. The findings are directly applicable to the design and dimensioning of such networks, particularly in determining the number of concurrent sessions that can be supported while maintaining acceptable quality of service.&lt;/p&gt;

&lt;div style=&quot;background-color: #ebf8ff; border-left: 4px solid #1f3864; border-radius: 0 4px 4px 0; color: #2d3748; margin: 15px 0; padding: 14px 18px;&quot;&gt;
    &lt;strong&gt;Conclusion:&lt;/strong&gt; This experiment successfully simulates seven concurrent FTP-like TCP sessions over a dumbbell network topology in ns-3. The bottleneck link constrains aggregate throughput to approximately 1.884 Mbps, representing 94.2% utilization of the 2 Mbps capacity. Individual flow throughput varies from 0.170 Mbps to 0.509 Mbps, reflecting the influence of staggered start times and TCP congestion dynamics. While bandwidth sharing is not perfectly equitable, TCP&#39;s AIMD mechanism ensures cooperative sharing without complete flow starvation.
&lt;/div&gt;

&lt;!-- Google AdSense --&gt;
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;!-- YouTube Subscribe Button --&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/4959338916269103610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/simulate-multiple-concurrent-ftp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/4959338916269103610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/4959338916269103610'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/simulate-multiple-concurrent-ftp.html' title='Simulate Multiple Concurrent FTP Sessions and Analyze Aggregate Throughput | NS3 Project 25'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgWvjcEf1JaM8K3T25ujd2taaNPuo8SS0BhhOEz76pY_XKv7Pm9nA6LyboDAgDGnn79Eh2YOIIg9YyktCaW5-AbElz7iho7eqDZoaq_1guc80hGft1Vn8LCxE2EJat4VmnltXD0uwi69baJoSXzzUzBwOPZwNHBJ6_gdnE8NUs8j7O8RoWvXcR3S6WoJbs=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-6234802999409605512</id><published>2026-08-20T10:09:10.192+05:30</published><updated>2026-09-08T15:03:50.676+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Study the effect of RED vs. DropTail queue management in a dumbbell topology | NS3 Project 24</title><content type='html'>&lt;p&gt;&lt;strong&gt;TOPIC:&lt;/strong&gt; Wired Networks &amp;amp; Point-to-Point&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TITLE:&lt;/strong&gt; Study the effect of RED vs. DropTail queue management in a dumbbell topology&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;QUEUE MANAGEMENT TECHNIQUES AND ITS TYPES – INTRODUCTION&lt;/strong&gt;&lt;/h3&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Queue management plays a critical role in controlling congestion in computer networks. In packet-switched networks, routers maintain queues to temporarily store packets before forwarding them. When network traffic increases beyond capacity, congestion occurs, leading to packet loss, increased delay, and reduced throughput.
&lt;/p&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Two widely used queue management techniques are &lt;strong&gt;DropTail Queue Management&lt;/strong&gt; and &lt;strong&gt;Random Early Detection (RED)&lt;/strong&gt;. DropTail is a simple First-In-First-Out (FIFO) mechanism where packets are dropped only when the queue becomes full.
&lt;/p&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  On the other hand, RED is an active queue management algorithm that proactively drops packets based on the average queue size before the queue becomes full. This helps in early congestion detection and improves overall network performance.
&lt;/p&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  In this assignment, a &lt;strong&gt;dumbbell topology&lt;/strong&gt; is implemented using NS-3.43 to simulate multiple TCP flows passing through a bottleneck link. The performance of RED and DropTail queue management techniques is analyzed and compared based on key metrics such as throughput, packet loss, and delay.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;WHAT DO WE WANT TO IMPLEMENT?&lt;/strong&gt;&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;To implement a dumbbell network topology using NS-3.43.&lt;/li&gt;
  &lt;li&gt;To simulate network traffic using TCP flows across a bottleneck link.&lt;/li&gt;
  &lt;li&gt;To analyze the behavior of &lt;strong&gt;DropTail Queue Management&lt;/strong&gt; and &lt;strong&gt;Random Early Detection (RED)&lt;/strong&gt; under congestion.&lt;/li&gt;
  &lt;li&gt;To evaluate performance metrics such as:
    &lt;ul&gt;
      &lt;li&gt;Throughput&lt;/li&gt;
      &lt;li&gt;Packet loss&lt;/li&gt;
      &lt;li&gt;End-to-end delay&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;To compare the efficiency of RED and DropTail in handling congestion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;IMPLEMENTATION:&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;We have used Mermaid live editor to create a visualization of the network we are creating to observe both the techniques:&lt;/p&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjwZnJvcQV-X_M_7HEf02nfva6Rj4Z0Nxz85qIDbuFxcNoZXO7NnCONSy_sMI7-cNMc_O6BgYMLSz6RZvLHIfFAwBf0eTvlqIU4Xlp3c_RMJJge12doYNPVqnPi7bWVcsT7rqNGuXML9ulbwIR2g0bLdX0ZAp9Lqk9u43oP9Y3tZOND768VHc09bGsaE3w&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; alt=&quot;Dumbbell Topology Diagram&quot; /&gt;
&lt;/p&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The above diagram represents the dumbbell topology implemented in the NS-3 simulation. It consists of two sender nodes (Node 0 and Node 1) on the left side and two receiver nodes (Node 2 and Node 3) on the right side, connected through two intermediate routers.
&lt;/p&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The access links between the end nodes and routers have a high bandwidth of 100 Mbps with low delay, ensuring that they do not become bottlenecks. The central link between Router 0 and Router 1 is configured as the bottleneck link with a bandwidth of 1 Mbps and higher delay. This link is where congestion occurs and where the queue management algorithms—RED and DropTail—are applied.
&lt;/p&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Multiple TCP flows are generated from the sender nodes to the receiver nodes, all passing through the bottleneck link. This setup creates network congestion, allowing the performance of RED and DropTail queue management techniques to be effectively analyzed in terms of congestion control, packet loss, queue occupancy, and throughput.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;SOURCE CODE:&lt;/strong&gt;&lt;/h3&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code&gt;#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/traffic-control-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/netanim-module.h&quot;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;Dumbbell_RED_DropTail&quot;);

// CWND Trace
static void CwndChange(Ptr&amp;lt;OutputStreamWrapper&amp;gt; stream, uint32_t oldCwnd, uint32_t newCwnd)
{
    *stream-&amp;gt;GetStream() &amp;lt;&amp;lt; Simulator::Now().GetSeconds() &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; newCwnd &amp;lt;&amp;lt; std::endl;
}

// Queue tracing function
static void QueueSizeTrace(Ptr&amp;lt;OutputStreamWrapper&amp;gt; stream, uint32_t oldVal, uint32_t newVal)
{
    *stream-&amp;gt;GetStream() &amp;lt;&amp;lt; Simulator::Now().GetSeconds() &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; newVal &amp;lt;&amp;lt; std::endl;
}

// Packet Drop tracing function
static void DropTracer(Ptr&amp;lt;OutputStreamWrapper&amp;gt; stream, Ptr&amp;lt;const QueueDiscItem&amp;gt; item)
{
    *stream-&amp;gt;GetStream() &amp;lt;&amp;lt; Simulator::Now().GetSeconds() &amp;lt;&amp;lt; &quot; 1&quot; &amp;lt;&amp;lt; std::endl;
}

int main(int argc, char *argv[])
{
    bool useRed = false;

    CommandLine cmd;
    cmd.AddValue(&quot;useRed&quot;, &quot;Enable RED queue&quot;, useRed);
    cmd.Parse(argc, argv);

    std::string prefix = useRed ? &quot;red&quot; : &quot;droptail&quot;;
    std::string animFile = prefix + &quot;.xml&quot;;
    std::string cwndFile = prefix + &quot;_cwnd.tr&quot;;
    std::string dropFile = prefix + &quot;_drops.tr&quot;;

    // -----------------------------
    // Create Nodes
    // -----------------------------
    NodeContainer leftNodes, rightNodes, routers;
    leftNodes.Create(2);
    rightNodes.Create(2);
    routers.Create(2);

    InternetStackHelper stack;
    stack.Install(leftNodes);
    stack.Install(rightNodes);
    stack.Install(routers);

    // -----------------------------
    // Link Configurations
    // -----------------------------
    PointToPointHelper accessLink;
    accessLink.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;100Mbps&quot;));
    accessLink.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));

    PointToPointHelper bottleneck;
    bottleneck.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;1Mbps&quot;));
    bottleneck.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;10ms&quot;));

    // -----------------------------
    // Install Links
    // -----------------------------
    NetDeviceContainer d0 = accessLink.Install(leftNodes.Get(0), routers.Get(0));
    NetDeviceContainer d1 = accessLink.Install(leftNodes.Get(1), routers.Get(0));

    NetDeviceContainer d2 = accessLink.Install(routers.Get(1), rightNodes.Get(0));
    NetDeviceContainer d3 = accessLink.Install(routers.Get(1), rightNodes.Get(1));

    NetDeviceContainer bottleneckDevices = bottleneck.Install(routers.Get(0), routers.Get(1));

    // -----------------------------
    // Queue Configuration
    // -----------------------------
    TrafficControlHelper tch;
    if (useRed)
    {
        std::cout &amp;lt;&amp;lt; &quot;Using RED Queue\n&quot;;
        tch.SetRootQueueDisc(&quot;ns3::RedQueueDisc&quot;,
                             &quot;MinTh&quot;, DoubleValue(5),
                             &quot;MaxTh&quot;, DoubleValue(15),
                             &quot;MaxSize&quot;, QueueSizeValue(QueueSize(&quot;20p&quot;)));
    }
    else
    {
        std::cout &amp;lt;&amp;lt; &quot;Using DropTail Queue\n&quot;;
        tch.SetRootQueueDisc(&quot;ns3::PfifoFastQueueDisc&quot;,
                             &quot;MaxSize&quot;, QueueSizeValue(QueueSize(&quot;5p&quot;)));
    }

    QueueDiscContainer qdiscs = tch.Install(bottleneckDevices);

    AsciiTraceHelper asciiDrop;
    Ptr&amp;lt;OutputStreamWrapper&amp;gt; dropStream = asciiDrop.CreateFileStream(prefix + &quot;_drops_exact.dat&quot;);

    for (uint32_t i = 0; i &amp;lt; qdiscs.GetN(); i++)
    {
        qdiscs.Get(i)-&amp;gt;TraceConnectWithoutContext(&quot;Drop&quot;, MakeBoundCallback(&amp;amp;DropTracer, dropStream));
    }

    AsciiTraceHelper asciiQueue;
    Ptr&amp;lt;OutputStreamWrapper&amp;gt; queueStream = asciiQueue.CreateFileStream(prefix + &quot;_queue.tr&quot;);

    for (uint32_t i = 0; i &amp;lt; qdiscs.GetN(); i++)
    {
        qdiscs.Get(i)-&amp;gt;TraceConnectWithoutContext(&quot;PacketsInQueue&quot;, MakeBoundCallback(&amp;amp;QueueSizeTrace, queueStream));
    }

    // -----------------------------
    // Assign IP Addresses
    // -----------------------------
    Ipv4AddressHelper address;

    address.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.0&quot;);
    address.Assign(d0);

    address.SetBase(&quot;10.1.2.0&quot;, &quot;255.255.255.0&quot;);
    address.Assign(d1);

    address.SetBase(&quot;10.1.3.0&quot;, &quot;255.255.255.0&quot;);
    address.Assign(d2);

    address.SetBase(&quot;10.1.4.0&quot;, &quot;255.255.255.0&quot;);
    address.Assign(d3);

    address.SetBase(&quot;10.1.5.0&quot;, &quot;255.255.255.0&quot;);
    address.Assign(bottleneckDevices);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    // -----------------------------
    // Applications
    // -----------------------------
    uint16_t port = 8080;

    Address sinkAddress(InetSocketAddress(Ipv4Address(&quot;10.1.3.2&quot;), port));
    PacketSinkHelper sinkHelper(&quot;ns3::TcpSocketFactory&quot;, sinkAddress);
    ApplicationContainer sinkApp = sinkHelper.Install(rightNodes.Get(0));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(20.0));

    BulkSendHelper source1(&quot;ns3::TcpSocketFactory&quot;, sinkAddress);
    source1.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(0));

    ApplicationContainer srcApp1 = source1.Install(leftNodes.Get(0));
    srcApp1.Start(Seconds(1.0));
    srcApp1.Stop(Seconds(20.0));

    BulkSendHelper source2(&quot;ns3::TcpSocketFactory&quot;, sinkAddress);
    source2.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(0));

    ApplicationContainer srcApp2 = source2.Install(leftNodes.Get(1));
    srcApp2.Start(Seconds(1.0));
    srcApp2.Stop(Seconds(20.0));

    // -----------------------------
    // Flow Monitor
    // -----------------------------
    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    // -----------------------------
    // ADD THIS: TraceMetrics ASCII trace
    // -----------------------------
    AsciiTraceHelper asciiTrace;
    accessLink.EnableAsciiAll(asciiTrace.CreateFileStream(prefix + &quot;_trace.tr&quot;));
    bottleneck.EnableAsciiAll(asciiTrace.CreateFileStream(prefix + &quot;_trace.tr&quot;));

    // -----------------------------
    // CWND tracing (delayed)
    // -----------------------------
    AsciiTraceHelper ascii;
    Ptr&amp;lt;OutputStreamWrapper&amp;gt; cwndStream = ascii.CreateFileStream(cwndFile);
    Simulator::Schedule(Seconds(1.1), [&amp;amp;]() {
        Config::ConnectWithoutContext(&quot;/NodeList/*/$ns3::TcpL4Protocol/SocketList/*/CongestionWindow&quot;,
                                      MakeBoundCallback(&amp;amp;CwndChange, cwndStream));
    });

    // -----------------------------
    // Wireshark (PCAP)
    // -----------------------------
    bottleneck.EnablePcapAll(prefix);

    // -----------------------------
    // Animation
    // -----------------------------
    AnimationInterface anim(animFile);

    anim.SetConstantPosition(leftNodes.Get(0), 0, 10);
    anim.SetConstantPosition(leftNodes.Get(1), 0, 0);
    anim.SetConstantPosition(routers.Get(0), 20, 5);
    anim.SetConstantPosition(routers.Get(1), 40, 5);
    anim.SetConstantPosition(rightNodes.Get(0), 60, 10);
    anim.SetConstantPosition(rightNodes.Get(1), 60, 0);

    // -----------------------------
    // Run Simulation
    // -----------------------------
    Simulator::Stop(Seconds(20.0));
    Simulator::Run();

    // -----------------------------
    // Results
    // -----------------------------
    monitor-&amp;gt;CheckForLostPackets();

    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats();

    for (auto &amp;amp;flow : stats)
    {
        std::cout &amp;lt;&amp;lt; &quot;\nFlow ID: &quot; &amp;lt;&amp;lt; flow.first &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Tx Packets: &quot; &amp;lt;&amp;lt; flow.second.txPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Rx Packets: &quot; &amp;lt;&amp;lt; flow.second.rxPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;Lost Packets: &quot; &amp;lt;&amp;lt; flow.second.txPackets - flow.second.rxPackets &amp;lt;&amp;lt; std::endl;

        double throughput = flow.second.rxBytes * 8.0 /
                            (flow.second.timeLastRxPacket.GetSeconds() -
                             flow.second.timeFirstTxPacket.GetSeconds()) / 1000;

        std::cout &amp;lt;&amp;lt; &quot;Throughput: &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &quot; Kbps\n&quot;;
    }

    Simulator::Destroy();
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;PROMPT USED:&lt;/strong&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Generate an ns-3 C++ program to study the effect of RED vs DropTail queue management in a dumbbell topology. As suggested by you we&#39;ll consider a 2-sender, 2-receiver topology. For the bottleneck link accordingly set the packet size, number of packets as well as bandwidth so that packet dropping and difference in both techniques can be observed clearly. The program should allow switching between RED and DropTail and enable observation of packet drops and performance. The code should contain NetAnim, FlowMonitor, and TraceMetrics snippets to view dropping of packets and compare, but make sure to add an if-else to store names according to technique (that is RED.tr and DropTail.tr) as well as pcap files to be enabled for Wireshark. Also generate gnuplot codes to clearly visualize efficiency, queue occupancy, throughput, packet drop rate in the two methods RED vs DropTail techniques.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;DROPTAIL QUEUE MANAGEMENT TECHNOLOGY&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;COMMAND PROMPT - FLOW MONITOR:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;80&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj1p3-phnpsiTuGOAMKB9hlJFDdr4WAL6xi2HHbGRzIYpPdfVKJ9_bXn821W531_yKXRf98YnefQwEGyog_sFEcmmkNVIenX3_mXpWYTamaY3KWLri_h-yVNBJJBFfmqpvn1UBKnIPZssbSQiHH938GLJUM_z5aiJFpjPxi2CxP0X_Hc_cC0wgOWoVkWBQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; alt=&quot;Flow Monitor Terminal Run&quot; /&gt;&lt;br /&gt;
  &lt;img height=&quot;401&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgBkLfaerI2E4dsS2H3CKmHZ25SYh5qwtZwWtXa6rUGlUgaT6bAyxcG-gmZDCCDjmkVt0m98j8bYUUKwtkiQSPv8HLCk-6AsF8uMZE9LuFa19nRU9mt-7sncKqudKNHkZW54C_YqO95jtchpeqM4kK_BtchfrnNe_oFJfWX9jrH6EwHUPkVfLT-NNSuJk4&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; alt=&quot;Flow Monitor Stats Output&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The FlowMonitor captures end-to-end performance by tracking every packet from the source (Left nodes) to the sink (Right nodes) across the bottleneck link. Under DropTail, the throughput often fluctuates as observed above. Because the network waits for the buffer to be 100% full before dropping, it causes a &quot;bursty&quot; loss pattern. This leads to lower link utilization compared to smoother algorithms, as the source repeatedly hits a wall and has to restart its transmission ramp-up.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TRACEMETRICS:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  TraceMetrics parses the &lt;code&gt;.tr&lt;/code&gt; (trace) file generated by ns-3 to visualize how individual packet arrival times vary over the 20-second simulation. In the attached images, you see a &quot;&lt;strong&gt;sawtooth&lt;/strong&gt;&quot; pattern in delay. As the queue fills up, delay increases linearly. When the &quot;&lt;strong&gt;Tail Drop&lt;/strong&gt;&quot; occurs and the queue empties, the delay drops sharply. This confirms that DropTail suffers from high bufferbloat (unnecessary queuing delay) right before a packet loss event.
&lt;/p&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiYXVxyfQDxk3cny40Eq2BleGOR_iqAZoyonQB3Yl_ZxRw9BAyR7y2GpnzYU4Nlh6oKU9OlvI5fA_1wBHiJnsKjRcK_j-fgptcXtLP3a0WngVVmG0fC4g645qVCkmVuBEAJsihfRD7_UY_V9GI-zFRvc1z0CiCg-veGvpCWyAw6BRy8Y5Dpwcrp7J4F6ec&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;331&quot; alt=&quot;TraceMetrics 1&quot; /&gt;
  &lt;img height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEib_QkL85wKsR2zigc6Hth6LL0BLgjHV1CqaslU_ipk7nRXTjWnvKhGD7Om1txqiVXPwLuES9r9dpkUHAdngRSIjVZHbkHyn1D_imj0JET7agEkF0KAvldf72v7tegvlrCWYkziSPAKkMKabdqCZGJhx8epGCEpiY1Aqbwap3R4g11leVGx4mKNbrPHcoE&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;334&quot; alt=&quot;TraceMetrics 2&quot; /&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;184&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgUJNvXz7y446RLxvOyoyjspOTzph3QdRiBeG3-39gtRsTvOg_YqNjpIWrkd_GByEKmCg-EFhmbAtgSQFyS2ltiHz1wXtCM0-qPerucOQWbJhN6qA9zVDvCl8Wr5UVV5UWwX-BKSMNcoFhgExq2rXblwLawYOYZEF-sEHFQcl7aOtt48g3JlOM0a5-3VLQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;290&quot; alt=&quot;TraceMetrics 3&quot; /&gt;
  &lt;img height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiapiXE1XtCf8BPXH1E4eVudciY4kv3ZKs5bztNdOnmyetuyQbxzjBR9CcHZIsEcEGntrQUEDB91B7QQFAKkVue9WV-O9683phAhZCWq0dvBI5IgBJeqhyVDQ9GrchIzNCO2a5q_YnYvzywCmGZfOzQGcY9VfsvVL14lmP0Li5pUj7puru4UPuRiDIS19A&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;290&quot; alt=&quot;TraceMetrics 4&quot; /&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg4Enkkc5T_8VMV_RxGxTmgiI3aunZxtQNoR4M9l6RHF9jKX1msJggdRVNjIbgW8awPRflnv1XMa61mv7QBobKYQZzWXR8EaUzgF45uzxEWzbF3AScPLtJrhjC4CM9jzCneIHAQ405VPr1IwKWxXRQOduKe_9hJp1FR8znAwHEh7ogu5ZJQrgqk8CRDe0E&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;288&quot; alt=&quot;TraceMetrics 5&quot; /&gt;
  &lt;img height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhYx6saO0b9maV76Qmg4EEYKI2z_QBd1bHyW8BqrjVqEkUSSiQ2tr3jvYLPNPS-iBeIk7VeG3oe2ynsBRYAqRZimRxxpXUGS4LiMTjhwpgxCjjPzA3nkzaJOFQUNb_fl09hM89lYTgO2wZ8mFT_jdA2n0pEAcz20S1L8BWA2iBGd4EEPFSREHvrIGH8PGg&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;288&quot; alt=&quot;TraceMetrics 6&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TRACEMETRICS GRAPH GENERATION:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;386&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiETkTN468wpiJ-End4AzSdqS3cUUdLnm6leE6PgZQ_nkWnvQ_idCn1cLGWiJoMRs-wn-f2LOB_zqZDEVs1DFIaREO2be-u7e0pOfn5wlixpmjLoOqadA4ST8-z-c7lPhzvCUS8lVK08j1M6QSRpubXKkPCb1pqv7paHpeV9nNpwiYqHzNku-HHHoQttFI&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;523&quot; alt=&quot;TraceMetrics Graph Output&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NETWORK ANIMATION (NetAnim):&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  NetAnim provides a graphical representation of the dumbbell topology, showing nodes (0, 1, 2, 3) and routers (4, 5) with packets moving across links. It visualizes &lt;strong&gt;Packet Flow&lt;/strong&gt; and &lt;strong&gt;Link Congestion&lt;/strong&gt; via colored dots representing data packets. The animation shows a high density of packets at Router 4. This visually identifies the bottleneck link. Under DropTail, you can observe &quot;bursts&quot; of packets being forwarded followed by gaps where the sender has slowed down due to a drop, illustrating the lack of steady-state flow.
&lt;/p&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;206&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjkwE-8SPxQcxq4t6rijoiWNA00HbccttfcqJL-VQBs9XBn6-EFuyrKuj-FDyuanDSB_ZP5v_jHW01lbuJqnmJdcYZoJWgZ6pujRm7SC9z8ilPVnezawGD72ftTkH0aFBbqdpvdJGBnXc92OXHNs9OIAs00UyaPEbtwe_AkGp4WS-PJSorVQr1ThI5BWBo&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;387&quot; alt=&quot;NetAnim DropTail 1&quot; /&gt;&lt;br /&gt;
  &lt;img height=&quot;208&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhDx_ZcfZ3Pivzq9DWXyB4lNCxAM-MIrXZF0lOvLBKcpHX-RFygzXLZhgD1l8bq5I5Dq0wCUVyctAyFtkQuGn_3D0VncAYtUm9cX2OWKDCYFs5t7wSddGUKsGCoQiGLsFIBRrmIm3mP3lJxgfumrKDnrUUOCX4Broe2QSqRNCKEWH_j8ZvE126nTtWNXxs&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;390&quot; alt=&quot;NetAnim DropTail 2&quot; /&gt;&lt;br /&gt;
  &lt;img height=&quot;210&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEie2tNwg_U4MkrbcorHo2M5E9bipQj_g8K2yYNMsqppuxJjjFdcDLK-YoXIZM8hGDIKXKLSeEOXluhnpuzGiArduBn05g7OXb8ktogtW1QbMwGn1Unl6HfaliEJuhAMTiCNkctJA5B22461bTmktekeXuLg1deRW5JjIY2zfu2uP6QG2-Dk-DpZyLYOzjw&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;395&quot; alt=&quot;NetAnim DropTail 3&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WIRESHARK:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhRoreboKjg3m6ZfXfcdi4IJsmpj998KpUVsK5Ohh05GCL6cyTkCBCZUIhLJTFa6GZcpU2NlYMoLPowihxOIP2uleTt3715wwkCZiMOVGMeaUVHaI6fj7lc14qthRJFJ1CsWR_GJ_oFY54z3kWU5UMLgixMVKhe2ANiHZ4Y6TZCwwA76lC3epcxeG-HpTE&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;504&quot; alt=&quot;Wireshark Trace Analysis&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The simulation generates &lt;code&gt;.pcap&lt;/code&gt; files for the point-to-point devices, which are opened in Wireshark to inspect the TCP handshake and data transfer. The DropTail Wireshark trace reveals &quot;TCP Fast Retransmit&quot; or &quot;Timeout&quot; events. When the tail of the queue is dropped, multiple packets from the same window are often lost. This causes the sender to enter a &quot;Slow Start&quot; phase, which is visible in Wireshark as a sudden halt in sequence number progression followed by a slow recovery.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;RED QUEUE MANAGEMENT TECHNOLOGY&lt;/strong&gt;&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;COMMAND PROMPT - FLOW MONITOR:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;47&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgQVkrr1m9PM3bGx4XJ6fRwhxxC1VFb4J3rTsJ-WO_NcTxUXdPBmLJmY19z-1781wis1iB152vnIbO0HtqeJQxq7V_t1VeTXUSnjYNFrY01f9kv6mLkn3AREHPgkLTa-t27QXcK63ZKEJZhzr7Z8r636sWevCkUvAQPH8DN-7IbDnQTUB3SEreaDDeiMro&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; alt=&quot;Flow Monitor RED Terminal Run&quot; /&gt;&lt;br /&gt;
  &lt;img height=&quot;382&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg8flD2UY1GaNe9bsVUPmaOsW9jbdYE0umSCv_ADWIAi0SGbmHgboicTeXab7UTs7Eq57uPUuGEJDvs8Z4kTeJQnxaTLdLKaBAw7ultVA3KwDF5AQn3-UtXnGRCF-gItozDtjTqm3LeqL9zUY-fL9_m83SrV1rPY_CwdYkdpuQs-jvx-KEGfPVn3HJxhbs&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; alt=&quot;Flow Monitor RED Stats Output&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  RED monitors the average queue size and begins dropping or marking packets based on statistical probability before the buffer is full. In the RED images, you will notice that packet losses are often more distributed rather than occurring in one giant block. The inference is that RED maintains a more consistent throughput. By proactively dropping packets, it prevents the bottleneck link from staying 100% saturated with &quot;stale&quot; data, allowing for a steadier flow and avoiding the &quot;all-or-nothing&quot; behavior seen in DropTail.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TRACEMETRICS:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;213&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjZd2tXHRahDKI7xu3wSbWIWTUaEOqqNvlJGKAzZ94WGhRlLG6ig9IL7fb3J5g2b-_e96tATyMp1yJ6iC04i2GTzC5R6rdByCV83137H1vHGauB19LjClffMMYe1n8x6P77yjwCNRnHiA_RuLRKjtSEQ3aMsEFF1_LEIBMrWNBgQoQimKXX5kOjN1TdttQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;335&quot; alt=&quot;TraceMetrics RED 1&quot; /&gt;
  &lt;img height=&quot;212&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhX3aZQ_lojxxBwcI0bLLcLRq4JmLFQMd09YkNYXKlsOnBBHgT3y6L7AN-UL3DYF9bChMPgH5YfBOJ24qeT6qzDW8KcV71S24RhPx196yatJjvc9FBKjAqNm_D1vcKAocObaqLDy9xAYNjJl33vlCHGnEcKDNy4Q2XRytsOSby6W6oRM09CgusEtnTwPqQ&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;334&quot; alt=&quot;TraceMetrics RED 2&quot; /&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;182&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgQcYHvUfBqUV-0GDMy2HQpWloM6FdjmRbVI4HC6Lzaca_IsL1mY2yhVelzVscjZ1nLAOibrPObLegkKKZus0nRunE7CyAYSID7-XWTb_0484cSqQlOexkyUZWEeWcjgUCOcsgXk2mdVIRAsp7gSoUFqnZwZHA3fF-H-I63S7gMF9VBNcsYzEEJeZ_QkHA&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;286&quot; alt=&quot;TraceMetrics RED 3&quot; /&gt;
  &lt;img height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgAeOP9iA8sjcB7HH4qmZh6tH-39aV5rAU6-YBwUgtOPHYfR19ss3nkUN9IV8inpGVBlxrg_HNRN27jsT1Y0j99FJHTMacIYr_0R-9OZYkOnhWcK4lBcIGKvRiASpJSAY5vjXrlwLKgrwspgVp8Y_SwDfFTR2eVSmipqW8ACHzdKaT3c9ihKY4Pw9UEtSs&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;289&quot; alt=&quot;TraceMetrics RED 4&quot; /&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi0k39idfBj3v5DZXOKCImcDGCyjpm6-aMMCfd4VtokWC8iJsYgk9f8TMgwY0pJ9VhWNUn6crtiZeJdMjQSqqlyV3SvGZcaY_LWoQiuXnEL3LmbhQjerKHdCXba9YuIUfVS2KosDmVUtf2EPOQwrdVnhXPiJen_xezipIiJIoojl21ZbSFyeuXde61X-44&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;288&quot; alt=&quot;TraceMetrics RED 5&quot; /&gt;
  &lt;img height=&quot;182&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj83Jvl_R8UUbNigauPtleZQiHtMLD4pjKjthflBU6Fdvi3N0f4sQO-uGItBnUp8wunGaGAOKqhwwl4YANA4H9rOHPXotYo1cZpCzmT57dCmXfYt7NQiiLQZFq-JJdHkPPF0FfqMx7JVnyqELz5S8lwO75dvDTiIGEvvc9sJNmDBjUWy4UkUlyEhQcOk24&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;285&quot; alt=&quot;TraceMetrics RED 6&quot; /&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;357&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgCBovzzW1KHnmt6QZX0V4EAhWYnmYlHO1gGJsMWeQHlwe2gastUBXEzAKH8wFbEdZK6npoVVGtPgetygyb7pQdmgNwbGAtqbSWX_pr4EK1aBqoqywmiV9cRSmXkG56a6Q1PrTlGpURlWwQB2BrEmyl4qyjw1gd-RTrPs-CHQTedTeBd9cqEv6sIaz15jE&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;476&quot; alt=&quot;TraceMetrics RED Graph Analysis&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The simulation uses thresholds (&lt;code&gt;MinTh = 5&lt;/code&gt;, &lt;code&gt;MaxTh = 15&lt;/code&gt;) to manage the queue. The algorithm calculates an &lt;em&gt;average&lt;/em&gt; queue size to decide the drop probability. It measures &lt;strong&gt;Mean Delay&lt;/strong&gt; and &lt;strong&gt;Packet Arrival Consistency&lt;/strong&gt;. The graph shows fewer extreme spikes in delay compared to DropTail. Because RED avoids keeping the buffer completely full, the average delay experienced by packets is lower. This demonstrates RED&#39;s ability to combat &quot;bufferbloat&quot;—the high latency caused by excessively large buffers.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NETWORK ANIMATION (NetAnim):&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The visualizer displays the movement of packets between the nodes and routers, colored by flow ID, illustrating &lt;strong&gt;Visual Flow Density&lt;/strong&gt; and &lt;strong&gt;Congestion Points&lt;/strong&gt;. In the RED simulation images, the traffic appears more fluid. You can observe that packets are being processed and cleared from Router 4 more regularly. This reflects RED&#39;s goal of &quot;Global Synchronization Avoidance,&quot; meaning different TCP flows don&#39;t all slow down at the exact same time, leading to better overall link utilization.
&lt;/p&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;251&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgMvg0insJ4I40bAsGpmwGBNGfzvBEXuHzJ7Yah4mbXU-xnHFzto5Nkdxq-HUDJ-3wFyCKjmcv2UVrUS84m8lHGc2oOmX7EixwriCJbPZHGrH6B5RKUH4ohCDsWs0Jc4iZlFWeZ8sJZzExRY-JmaceMVeU3Kj1WyayqO8-PQBVbO85hwzYIAnUGI-UJ6YY&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;471&quot; alt=&quot;NetAnim RED 1&quot; /&gt;&lt;br /&gt;
  &lt;img height=&quot;251&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg0UHdnpkBzz3CbittUOo7uR6KRhwf4X2shk-0e-UFW0oPnAq_qw0zk9gm3YzqIhvvpqph2_HNUSItCKr4_ZQHIp7oP4rejSXO1r90CStQk0fuuqZIAKe7duuZRBiusRlH96nPsh73ltAQR_-YbtMLIKhbUYkc_iQvNsNEJ148IW3wxYH6aZgoTRfS9X0w&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;472&quot; alt=&quot;NetAnim RED 2&quot; /&gt;&lt;br /&gt;
  &lt;img height=&quot;247&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiyRa-5-KvjEKLTNQ5BzXX9224tRAgoJGl-YmuMtfXNHUpcscUzF5flm5LadQevrbQb-ey7Q6MF-R3Uzw_OjB4AcnixdHyCHcWppKaHfXbIAn3RYip-Hh7wjdEF_A4lWAssncO9rPu2TT7EZAG72rG_NiFsPia56skP0QrmIvO2OgAGY_R4M5GLLWU6_w0&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;464&quot; alt=&quot;NetAnim RED 3&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WIRESHARK:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg5iqe6atQAc3NAnUMsPRmaZOAfmWeq5z17jW1trypgfAe5OuqTDZkXBQYjrvq6gvUv5RNUnoIA17mV77cPIuMDN4VM3JykEF42zoKLYNlJAMNndJK2CJ1UE1t-fwclHyo67fVOeVrwoR0DpFeNr9LWTKH4Q-ecEDJe1j171v9-zKWhBIruP681y4im9Jw&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;606&quot; alt=&quot;Wireshark RED Packet Inspection&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Wireshark captures the specific packet sequence numbers as they exit the router interface. The RED trace shows &quot;Early Drops&quot; where a single packet might be missing even while others continue to arrive. This allows the sender (TCP) to detect congestion early via &quot;Triple Duplicate ACKs&quot; and reduce its window size gracefully. The inference is a much smoother &quot;Congestion Window&quot; (CWND) adjustment, which prevents the connection from timing out and falling into the slow-start recovery phase.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;RED vs. DropTail: GNUPLOT COMPARISONS&lt;/strong&gt;&lt;/h2&gt;

&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Now, we have implemented both techniques, obtained throughput data, and stored packet drop data as well as queue occupancy data according to their respective callback functions. Let&#39;s create comparative graphs using GNUPLOT:
&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;h4&gt;&lt;strong&gt;EFFICIENCY COMPARISON (CWND)&lt;/strong&gt;&lt;/h4&gt;
    &lt;p&gt;&lt;strong&gt;GNUPLOT CODE:&lt;/strong&gt;&lt;/p&gt;
&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code&gt;set title &quot;RED vs DropTail - TCP Congestion Window Comparison&quot;
set xlabel &quot;Time (seconds)&quot;
set ylabel &quot;CWND (KB)&quot;
set grid

set terminal png size 900,600
set output &quot;comparison.png&quot;

plot &quot;droptail_cwnd.tr&quot; using 1:($2/1024) with lines lw 2 title &quot;DropTail&quot;, \
     &quot;red_cwnd.tr&quot; using 1:($2/1024) with lines lw 2 title &quot;RED&quot;&lt;/code&gt;&lt;/pre&gt;

    &lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: center;&quot;&gt;
      &lt;img height=&quot;326&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhXzxWxg831hJlITfeqjQNwlA9a9dtZWXHtz87fOTCoyHv3E1BVNO7yseMWEI24n_B3e3aeKuQvLaGiUTuNY4VaEQFgdnOTHRLvx6Jw49Mvr6HPR_h2fQfC0bhjvQpgDecqgTAXfKheZ4tFSO94jd48GKrVAbZgSIF7JCWXVPdbPPyXCStMLp1niQ0ww0I&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;489&quot; alt=&quot;CWND Comparison Graph&quot; /&gt;
    &lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
      The CWND graph shows the variation of TCP congestion window over time for both RED and DropTail. Both algorithms exhibit the typical TCP behavior of increase followed by sudden drops due to packet loss. DropTail shows sharper and more abrupt drops due to buffer overflow, while RED shows comparatively smoother reductions due to early packet dropping. Hence, RED provides slightly better congestion control, although the difference is not very large due to the limited number of flows in the simulation.
    &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;h4&gt;&lt;strong&gt;PACKET DROP COMPARISON&lt;/strong&gt;&lt;/h4&gt;
    &lt;p&gt;&lt;strong&gt;GNUPLOT CODE:&lt;/strong&gt;&lt;/p&gt;
&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code&gt;set terminal pngcairo font &quot;arial,12&quot; size 1000,600
set output &#39;drop_rate_final.png&#39;

set title &quot;Packet Drop Intensity over Time (RED vs DropTail)&quot;
set xlabel &quot;Time (Seconds)&quot;
set ylabel &quot;Packet Drops per 0.1s Interval&quot; 
set grid 

set xrange [4:16]
set yrange [0:*] 
set style line 1 lc rgb &#39;#d62728&#39; lw 2 pt 7 ps 0.8 # Red
set style line 2 lc rgb &#39;#1f77b4&#39; lw 2 pt 7 ps 0.8 # Blue

binwidth = 0.1
bin(x) = binwidth * floor(x/binwidth)

plot &quot;droptail_drops_exact.dat&quot; using (bin($1)):2 smooth frequency with lines ls 1 title &quot;DropTail&quot;, \
     &quot;red_drops_exact.dat&quot;      using (bin($1)):2 smooth frequency with lines ls 2 title &quot;RED&quot;&lt;/code&gt;&lt;/pre&gt;

    &lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: center;&quot;&gt;
      &lt;img height=&quot;318&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh26DNnGDYkUTSuuOBzbEswYDsezHdeNEkCNXoo78S_9sPamRkNKeJH6y2P0BgtX8tibMzY8L6u-YaD1Z7utnQafbZDovn2Q8fIkEhFOFfWqeLYj7iDKaVhTOkluSMwHB5Hxjzyf-BPyESv5PZ2WpkqivGThX4-VEb36SdDOpZI4hQakWnrj-j-U864LZA&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;530&quot; alt=&quot;Packet Drop Comparison Graph&quot; /&gt;
    &lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
      The packet drop graph shows that DropTail experiences sudden spikes in packet drops when the queue becomes full. In contrast, RED distributes packet drops more gradually over time due to early congestion detection. This prevents burst losses and improves network stability. However, since only two flows are used, the difference between RED and DropTail is moderate rather than highly significant.
    &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;h4&gt;&lt;strong&gt;QUEUE SIZE COMPARISON&lt;/strong&gt;&lt;/h4&gt;
    &lt;p&gt;&lt;strong&gt;GNUPLOT CODE:&lt;/strong&gt;&lt;/p&gt;
&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code&gt;set terminal pngcairo font &quot;arial,12&quot; size 1000,600
set output &#39;queue_comparison.png&#39;

set title &quot;QUEUE OCCUPANCY: RED vs DropTail&quot;
set xlabel &quot;Time (Seconds)&quot;
set ylabel &quot;Average Packets in Queue&quot;
set grid
set tics nomirror
set xrange [4:18]
set yrange [0:22]

set style line 1 lc rgb &#39;#d62728&#39; lw 3  # Red
set style line 2 lc rgb &#39;#1f77b4&#39; lw 3  # Blue

plot &quot;droptail_queue.tr&quot; using 1:2:(1.0) smooth acsplines ls 1 title &quot;DropTail&quot;, \
     &quot;red_queue.tr&quot; using 1:2:(1.0) smooth acsplines ls 2 title &quot;RED&quot;&lt;/code&gt;&lt;/pre&gt;

    &lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: center;&quot;&gt;
      &lt;img height=&quot;325&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiD83WiMvT0OQhOC_I5-XRUdeAF2m3FOC7RxXxJrQLgQpnJbnaNnKonllXhPgsb23GMgL_AX-N7AuuEIpU7Ifp1tbIj5i4Mia3X_RXrIyFErS2QPDpx5pHijRMiyK3XC0lTsS5sKFWglpqYdxPU2YoPcOgIsXdEuGbxOzJJEbtMb4q_B1BAQKn13TXqPno&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;542&quot; alt=&quot;Queue Size Comparison Graph&quot; /&gt;
    &lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
      The queue size graph shows that RED maintains a higher queue occupancy compared to DropTail. This behavior is due to the configuration used in the simulation, where the RED queue has a maximum size of 20 packets, while the DropTail queue is limited to only 5 packets. As a result, DropTail cannot build up a large queue and drops packets earlier, whereas RED allows more packets to be buffered before applying congestion control. Therefore, the observed behavior is a result of unequal queue sizes rather than the inherent superiority of either algorithm.
    &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;h4&gt;&lt;strong&gt;THROUGHPUT COMPARISON&lt;/strong&gt;&lt;/h4&gt;
    &lt;p&gt;&lt;strong&gt;GNUPLOT CODE:&lt;/strong&gt;&lt;/p&gt;
&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code&gt;set title &quot;Throughput Comparison (TraceMetrics)&quot;
set xlabel &quot;Time (seconds)&quot;
set ylabel &quot;Throughput (Kbps)&quot;
set grid

set terminal png size 900,600
set output &quot;throughput.png&quot;

plot &quot;droptail_tp.txt&quot; using 1:2 with lines lw 2 title &quot;DropTail&quot;, \
     &quot;red_tp.txt&quot; using 1:2 with lines lw 2 title &quot;RED&quot;&lt;/code&gt;&lt;/pre&gt;

    &lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: center;&quot;&gt;
      &lt;img height=&quot;336&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhcqoNYoFNXAf2y1_G5-nDZ-NqHsHiS2D2Z0JjPvOHiwyr0_85CD3twm7LAqsCYfcLyKPooqYTpxi-koqKyLaDAWiAYhrcPOZ2zAsAIkhxpFqQxoEVwH1PAd4v9eUZe4P9XjrZ7ZLCpFhnLBVhqRmMd8BexYJmWquL4ftO6IXEpGCDYH2OcwEQxcAXc5nc&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;504&quot; alt=&quot;Throughput Comparison Graph&quot; /&gt;
    &lt;/p&gt;

    &lt;p&gt;&lt;strong&gt;EXPLANATION:&lt;/strong&gt;&lt;/p&gt;
    &lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
      The throughput graph shows that both RED and DropTail achieve similar throughput values over time. This is because the simulation uses only two TCP flows and a moderate bottleneck bandwidth, resulting in limited congestion. As a result, both queue management techniques perform similarly in terms of throughput, and no significant difference is observed between them.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;INFERENCE&lt;/strong&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The simulation results show noticeable differences between RED and DropTail queue management techniques, but these differences are influenced by the configuration used in the implementation. The congestion window (CWND) graph indicates that both RED and DropTail follow standard TCP behavior, with periods of growth followed by sudden reductions due to packet loss. DropTail exhibits sharper drops, while RED shows relatively smoother variations due to early packet dropping.
&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The packet drop graph demonstrates that DropTail experiences burst packet losses when the queue becomes full, whereas RED distributes packet drops more evenly over time. This confirms that RED performs proactive congestion control compared to the reactive behavior of DropTail. However, the queue size graph shows that RED maintains a higher queue occupancy than DropTail. This behavior is due to the configuration in the simulation, where the RED queue has a larger maximum size (20 packets) compared to the DropTail queue (5 packets). As a result, DropTail cannot accumulate a large number of packets and drops them earlier, while RED allows more packets to be buffered.
&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The throughput graph indicates that both RED and DropTail achieve similar throughput values. This is because the simulation uses only two TCP flows and a moderate bottleneck bandwidth, resulting in limited congestion. Hence, the performance difference in throughput is not very significant. Overall, the results indicate that while RED provides smoother congestion control and more evenly distributed packet drops, the observed behavior is partially influenced by unequal queue sizes and limited traffic load rather than purely algorithmic differences.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;CONCLUSION&lt;/strong&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  This project successfully demonstrates the impact of queue management techniques on network performance using a dumbbell topology in NS-3.43. The results show that &lt;strong&gt;DropTail Queue Management&lt;/strong&gt;, while simple to implement, is not efficient under heavy traffic conditions due to its reactive nature. It leads to higher delay, burst packet losses, and synchronization issues among flows. On the other hand, &lt;strong&gt;Random Early Detection (RED)&lt;/strong&gt; provides better congestion control by proactively managing queue size. It reduces packet loss, maintains stable throughput, and improves overall network performance. Therefore, RED is a more effective queue management technique compared to DropTail, especially in scenarios involving high traffic and multiple concurrent flows.
&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/6234802999409605512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/6234802999409605512'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/study-effect-of-red-vs-droptail-queue.html' title='Study the effect of RED vs. DropTail queue management in a dumbbell topology | NS3 Project 24'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjwZnJvcQV-X_M_7HEf02nfva6Rj4Z0Nxz85qIDbuFxcNoZXO7NnCONSy_sMI7-cNMc_O6BgYMLSz6RZvLHIfFAwBf0eTvlqIU4Xlp3c_RMJJge12doYNPVqnPi7bWVcsT7rqNGuXML9ulbwIR2g0bLdX0ZAp9Lqk9u43oP9Y3tZOND768VHc09bGsaE3w=s72-c" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-8799298456622058711</id><published>2026-08-20T10:03:40.848+05:30</published><updated>2026-09-08T15:10:24.767+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>TCP Reno, NewReno, Cubic, and Vegas Comparison under 5% Random Packet Loss in Wired Topology | NS3 Project 23</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;TCP Reno, NewReno, Cubic, and Vegas Comparison under 5% Random Packet Loss in Wired Topology&lt;/h1&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Prompt Used&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LLM Used:&lt;/strong&gt; Claude (Anthropic)&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Prompt:&lt;/h2&gt;
&lt;p style=&quot;line-height: 1.6;&quot;&gt;
  Write NS-3 C++ code to compare TCP Reno, NewReno, Cubic, and Vegas under 5% random packet loss in a wired topology. The simulation should:
&lt;/p&gt;
&lt;ol style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;Create a point-to-point wired network topology&lt;/li&gt;
  &lt;li&gt;Implement 5% random packet loss using error model&lt;/li&gt;
  &lt;li&gt;Run simulations for all four TCP variants&lt;/li&gt;
  &lt;li&gt;Generate NetAnim XML file for visualization&lt;/li&gt;
  &lt;li&gt;Output throughput data for gnuplot graphs&lt;/li&gt;
  &lt;li&gt;Use proper NS-3 coding conventions&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The file should be named &lt;code&gt;tcp_comparison.cc&lt;/code&gt; and run with &lt;code&gt;./ns3 run scratch/tcp_comparison.cc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Source Code (&lt;code&gt;tcp_comparison.cc&lt;/code&gt;)&lt;/h2&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code class=&quot;language-cpp&quot;&gt;/* -*- Mode:C++; c-file-style:&quot;gnu&quot;; indent-tabs-mode:nil; -*- */
/*
 * TCP Variants Comparison under 5% Packet Loss
 * Comparing: Reno, NewReno, Cubic, Vegas
 * Wired Topology with Random Packet Loss
 */

#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/netanim-module.h&quot;
#include &quot;ns3/traffic-control-module.h&quot;

#include &amp;lt;fstream&amp;gt;
#include &amp;lt;string&amp;gt;
#include &amp;lt;map&amp;gt;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;TcpVariantsComparison&quot;);

// Global variables for tracing
std::map&amp;lt;std::string, std::ofstream*&amp;gt; cwndFiles;
std::map&amp;lt;std::string, std::ofstream*&amp;gt; throughputFiles;
std::map&amp;lt;std::string, uint64_t&amp;gt; lastTotalRx;
std::map&amp;lt;std::string, Ptr&amp;lt;PacketSink&amp;gt;&amp;gt; sinkApps;

// Congestion window tracer
void CwndTracer(std::string context, uint32_t oldCwnd, uint32_t newCwnd)
{
    std::string variant = context;
    if (cwndFiles.find(variant) != cwndFiles.end() &amp;amp;&amp;amp; cwndFiles[variant]-&amp;gt;is_open())
    {
        *cwndFiles[variant] &amp;lt;&amp;lt; Simulator::Now().GetSeconds() &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; newCwnd &amp;lt;&amp;lt; std::endl;
    }
}

// Throughput calculator
void CalculateThroughput(std::string variant)
{
    if (sinkApps.find(variant) != sinkApps.end())
    {
        uint64_t totalRx = sinkApps[variant]-&amp;gt;GetTotalRx();
        double throughput = (totalRx - lastTotalRx[variant]) * 8.0 / 0.1 / 1000000; // Mbps
        lastTotalRx[variant] = totalRx;

        if (throughputFiles.find(variant) != throughputFiles.end() &amp;amp;&amp;amp; throughputFiles[variant]-&amp;gt;is_open())
        {
            *throughputFiles[variant] &amp;lt;&amp;lt; Simulator::Now().GetSeconds() &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; std::endl;
        }
    }
    if (Simulator::Now().GetSeconds() &amp;lt; 30.0)
    {
        Simulator::Schedule(Seconds(0.1), &amp;amp;CalculateThroughput, variant);
    }
}

// Run simulation for a specific TCP variant
void RunSimulation(std::string tcpVariant, double packetLossRate)
{
    std::cout &amp;lt;&amp;lt; &quot;\n========================================&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;Running simulation for TCP &quot; &amp;lt;&amp;lt; tcpVariant &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;Packet Loss Rate: &quot; &amp;lt;&amp;lt; packetLossRate * 100 &amp;lt;&amp;lt; &quot;%&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;========================================\n&quot; &amp;lt;&amp;lt; std::endl;

    // Set TCP variant
    std::string tcpTypeId;
    if (tcpVariant == &quot;Reno&quot;)
    {
        tcpTypeId = &quot;ns3::TcpLinuxReno&quot;;
    }
    else if (tcpVariant == &quot;NewReno&quot;)
    {
        tcpTypeId = &quot;ns3::TcpNewReno&quot;;
    }
    else if (tcpVariant == &quot;Cubic&quot;)
    {
        tcpTypeId = &quot;ns3::TcpCubic&quot;;
    }
    else if (tcpVariant == &quot;Vegas&quot;)
    {
        tcpTypeId = &quot;ns3::TcpVegas&quot;;
    }
    else
    {
        NS_LOG_ERROR(&quot;Unknown TCP variant: &quot; &amp;lt;&amp;lt; tcpVariant);
        return;
    }

    Config::SetDefault(&quot;ns3::TcpL4Protocol::SocketType&quot;, TypeIdValue(TypeId::LookupByName(tcpTypeId)));
    Config::SetDefault(&quot;ns3::TcpSocket::SegmentSize&quot;, UintegerValue(1448));
    Config::SetDefault(&quot;ns3::TcpSocket::InitialCwnd&quot;, UintegerValue(1));

    // Create nodes
    NodeContainer senderNode, receiverNode, routerNodes;
    senderNode.Create(1);
    receiverNode.Create(1);
    routerNodes.Create(2);

    // Create point-to-point links
    PointToPointHelper p2pSender, p2pReceiver, p2pBottleneck;

    // Sender to Router1: 100 Mbps, 2ms delay
    p2pSender.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;100Mbps&quot;));
    p2pSender.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));

    // Router2 to Receiver: 100 Mbps, 2ms delay
    p2pReceiver.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;100Mbps&quot;));
    p2pReceiver.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));

    // Bottleneck link: 10 Mbps, 10ms delay
    p2pBottleneck.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;10Mbps&quot;));
    p2pBottleneck.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;10ms&quot;));

    // Install links
    NetDeviceContainer senderDevices = p2pSender.Install(senderNode.Get(0), routerNodes.Get(0));
    NetDeviceContainer bottleneckDevices = p2pBottleneck.Install(routerNodes.Get(0), routerNodes.Get(1));
    NetDeviceContainer receiverDevices = p2pReceiver.Install(routerNodes.Get(1), receiverNode.Get(0));

    // Add random packet loss to bottleneck link (5%)
    Ptr&amp;lt;RateErrorModel&amp;gt; errorModel = CreateObject&amp;lt;RateErrorModel&amp;gt;();
    errorModel-&amp;gt;SetAttribute(&quot;ErrorRate&quot;, DoubleValue(packetLossRate));
    errorModel-&amp;gt;SetAttribute(&quot;ErrorUnit&quot;, EnumValue(RateErrorModel::ERROR_UNIT_PACKET));
    bottleneckDevices.Get(1)-&amp;gt;SetAttribute(&quot;ReceiveErrorModel&quot;, PointerValue(errorModel));

    // Install internet stack
    InternetStackHelper internet;
    internet.Install(senderNode);
    internet.Install(receiverNode);
    internet.Install(routerNodes);

    // Assign IP addresses
    Ipv4AddressHelper ipv4;
    ipv4.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer senderInterfaces = ipv4.Assign(senderDevices);

    ipv4.SetBase(&quot;10.1.2.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer bottleneckInterfaces = ipv4.Assign(bottleneckDevices);

    ipv4.SetBase(&quot;10.1.3.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer receiverInterfaces = ipv4.Assign(receiverDevices);

    // Set up routing
    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    // Create applications
    uint16_t port = 9;

    // Packet sink on receiver
    PacketSinkHelper sinkHelper(&quot;ns3::TcpSocketFactory&quot;,
                                InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApp = sinkHelper.Install(receiverNode.Get(0));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(30.0));
    sinkApps[tcpVariant] = DynamicCast&amp;lt;PacketSink&amp;gt;(sinkApp.Get(0));
    lastTotalRx[tcpVariant] = 0;

    // Bulk send on sender
    BulkSendHelper sourceHelper(&quot;ns3::TcpSocketFactory&quot;,
                                InetSocketAddress(receiverInterfaces.GetAddress(1), port));
    sourceHelper.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(0)); // Unlimited
    sourceHelper.SetAttribute(&quot;SendSize&quot;, UintegerValue(1448));
    ApplicationContainer sourceApp = sourceHelper.Install(senderNode.Get(0));
    sourceApp.Start(Seconds(1.0));
    sourceApp.Stop(Seconds(29.0));

    // Open output files
    std::string cwndFilename = &quot;tcp-&quot; + tcpVariant + &quot;-cwnd.dat&quot;;
    std::string throughputFilename = &quot;tcp-&quot; + tcpVariant + &quot;-throughput.dat&quot;;
    cwndFiles[tcpVariant] = new std::ofstream(cwndFilename.c_str());
    throughputFiles[tcpVariant] = new std::ofstream(throughputFilename.c_str());

    // Set up congestion window tracing
    Simulator::Schedule(Seconds(1.001), [tcpVariant]() {
        Config::ConnectWithoutContext(&quot;/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow&quot;,
                                      MakeBoundCallback(&amp;amp;CwndTracer, tcpVariant));
    });

    // Schedule throughput calculation
    Simulator::Schedule(Seconds(1.1), &amp;amp;CalculateThroughput, tcpVariant);

    // Flow monitor
    FlowMonitorHelper flowHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt; flowMonitor = flowHelper.InstallAll();

    // NetAnim setup
    std::string animFilename = &quot;tcp-&quot; + tcpVariant + &quot;-animation.xml&quot;;
    AnimationInterface anim(animFilename);

    // Set node positions for visualization
    anim.SetConstantPosition(senderNode.Get(0), 10.0, 50.0);
    anim.SetConstantPosition(routerNodes.Get(0), 40.0, 50.0);
    anim.SetConstantPosition(routerNodes.Get(1), 70.0, 50.0);
    anim.SetConstantPosition(receiverNode.Get(0), 100.0, 50.0);

    // Set node descriptions
    anim.UpdateNodeDescription(senderNode.Get(0), &quot;Sender&quot;);
    anim.UpdateNodeDescription(routerNodes.Get(0), &quot;Router1&quot;);
    anim.UpdateNodeDescription(routerNodes.Get(1), &quot;Router2&quot;);
    anim.UpdateNodeDescription(receiverNode.Get(0), &quot;Receiver&quot;);

    // Set node colors
    anim.UpdateNodeColor(senderNode.Get(0), 0, 255, 0);     // Green
    anim.UpdateNodeColor(routerNodes.Get(0), 0, 0, 255);   // Blue
    anim.UpdateNodeColor(routerNodes.Get(1), 0, 0, 255);   // Blue
    anim.UpdateNodeColor(receiverNode.Get(0), 255, 0, 0);   // Red

    // Run simulation
    Simulator::Stop(Seconds(30.0));
    Simulator::Run();

    // Print flow monitor statistics
    flowMonitor-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier = DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowHelper.GetClassifier());
    FlowMonitor::FlowStatsContainer stats = flowMonitor-&amp;gt;GetFlowStats();

    std::cout &amp;lt;&amp;lt; &quot;\n--- Flow Statistics for TCP &quot; &amp;lt;&amp;lt; tcpVariant &amp;lt;&amp;lt; &quot; ---\n&quot; &amp;lt;&amp;lt; std::endl;
    for (auto const &amp;amp;flow : stats)
    {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(flow.first);
        std::cout &amp;lt;&amp;lt; &quot;Flow &quot; &amp;lt;&amp;lt; flow.first &amp;lt;&amp;lt; &quot; (&quot; &amp;lt;&amp;lt; t.sourceAddress &amp;lt;&amp;lt; &quot; -&amp;gt; &quot; &amp;lt;&amp;lt; t.destinationAddress &amp;lt;&amp;lt; &quot;)&quot; &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;  Tx Packets: &quot; &amp;lt;&amp;lt; flow.second.txPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;  Rx Packets: &quot; &amp;lt;&amp;lt; flow.second.rxPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;  Lost Packets: &quot; &amp;lt;&amp;lt; flow.second.lostPackets &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot;  Packet Loss Ratio: &quot; &amp;lt;&amp;lt; (double)flow.second.lostPackets / flow.second.txPackets * 100 &amp;lt;&amp;lt; &quot;%&quot; &amp;lt;&amp;lt; std::endl;

        if (flow.second.rxPackets &amp;gt; 0)
        {
            double throughput = flow.second.rxBytes * 8.0 / 
                               (flow.second.timeLastRxPacket.GetSeconds() - flow.second.timeFirstTxPacket.GetSeconds()) / 1000000;
            std::cout &amp;lt;&amp;lt; &quot;  Throughput: &quot; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &quot; Mbps&quot; &amp;lt;&amp;lt; std::endl;
            std::cout &amp;lt;&amp;lt; &quot;  Mean Delay: &quot; &amp;lt;&amp;lt; flow.second.delaySum.GetSeconds() / flow.second.rxPackets * 1000 &amp;lt;&amp;lt; &quot; ms&quot; &amp;lt;&amp;lt; std::endl;
            std::cout &amp;lt;&amp;lt; &quot;  Mean Jitter: &quot; &amp;lt;&amp;lt; flow.second.jitterSum.GetSeconds() / flow.second.rxPackets * 1000 &amp;lt;&amp;lt; &quot; ms&quot; &amp;lt;&amp;lt; std::endl;
        }
        std::cout &amp;lt;&amp;lt; std::endl;
    }

    // Close output files
    if (cwndFiles[tcpVariant]-&amp;gt;is_open())
    {
        cwndFiles[tcpVariant]-&amp;gt;close();
    }
    if (throughputFiles[tcpVariant]-&amp;gt;is_open())
    {
        throughputFiles[tcpVariant]-&amp;gt;close();
    }
    delete cwndFiles[tcpVariant];
    delete throughputFiles[tcpVariant];

    Simulator::Destroy();
}

int main(int argc, char *argv[])
{
    // Command line arguments
    double packetLossRate = 0.05; // 5% packet loss
    std::string variant = &quot;all&quot;;

    CommandLine cmd(__FILE__);
    cmd.AddValue(&quot;lossRate&quot;, &quot;Packet loss rate (0.0 to 1.0)&quot;, packetLossRate);
    cmd.AddValue(&quot;variant&quot;, &quot;TCP variant (Reno/NewReno/Cubic/Vegas/all)&quot;, variant);
    cmd.Parse(argc, argv);

    // Enable logging
    LogComponentEnable(&quot;TcpVariantsComparison&quot;, LOG_LEVEL_INFO);

    std::cout &amp;lt;&amp;lt; &quot;\n********************************************************&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;* TCP Variants Comparison under &quot; &amp;lt;&amp;lt; packetLossRate * 100 &amp;lt;&amp;lt; &quot;% Packet Loss *&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;* Wired Topology: Sender -- R1 -- R2 -- Receiver       *&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;********************************************************\n&quot; &amp;lt;&amp;lt; std::endl;

    // List of TCP variants to test
    std::vector&amp;lt;std::string&amp;gt; variants;
    if (variant == &quot;all&quot;)
    {
        variants = {&quot;Reno&quot;, &quot;NewReno&quot;, &quot;Cubic&quot;, &quot;Vegas&quot;};
    }
    else
    {
        variants = {variant};
    }

    // Run simulation for each variant
    for (const auto &amp;amp;v : variants)
    {
        RunSimulation(v, packetLossRate);
    }

    // Generate gnuplot script for comparison
    std::ofstream gnuplotScript(&quot;plot-comparison.plt&quot;);
    gnuplotScript &amp;lt;&amp;lt; &quot;# Gnuplot script for TCP variants comparison\n\n&quot;;

    // Throughput comparison plot
    gnuplotScript &amp;lt;&amp;lt; &quot;set terminal png size 1200,800 enhanced font &#39;Arial,12&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set output &#39;tcp-throughput-comparison.png&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set title &#39;TCP Throughput Comparison under 5% Packet Loss&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set xlabel &#39;Time (seconds)&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set ylabel &#39;Throughput (Mbps)&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set grid\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set key right top\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;plot &#39;tcp-Reno-throughput.dat&#39; with lines lw 2 title &#39;TCP Reno&#39;, \\\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;     &#39;tcp-NewReno-throughput.dat&#39; with lines lw 2 title &#39;TCP NewReno&#39;, \\\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;     &#39;tcp-Cubic-throughput.dat&#39; with lines lw 2 title &#39;TCP Cubic&#39;, \\\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;     &#39;tcp-Vegas-throughput.dat&#39; with lines lw 2 title &#39;TCP Vegas&#39;\n\n&quot;;

    // Congestion window comparison plot
    gnuplotScript &amp;lt;&amp;lt; &quot;set output &#39;tcp-cwnd-comparison.png&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set title &#39;TCP Congestion Window Comparison under 5% Packet Loss&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set xlabel &#39;Time (seconds)&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set ylabel &#39;Congestion Window (bytes)&#39;\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set grid\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;set key right top\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;plot &#39;tcp-Reno-cwnd.dat&#39; with lines lw 2 title &#39;TCP Reno&#39;, \\\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;     &#39;tcp-NewReno-cwnd.dat&#39; with lines lw 2 title &#39;TCP NewReno&#39;, \\\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;     &#39;tcp-Cubic-cwnd.dat&#39; with lines lw 2 title &#39;TCP Cubic&#39;, \\\n&quot;;
    gnuplotScript &amp;lt;&amp;lt; &quot;     &#39;tcp-Vegas-cwnd.dat&#39; with lines lw 2 title &#39;TCP Vegas&#39;\n&quot;;

    gnuplotScript.close();

    std::cout &amp;lt;&amp;lt; &quot;\n========================================&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;Simulation Complete!&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;========================================&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;\nOutput files generated:&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;- Animation files: tcp-&amp;lt;variant&amp;gt;-animation.xml&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;- Throughput data: tcp-&amp;lt;variant&amp;gt;-throughput.dat&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;- CWND data: tcp-&amp;lt;variant&amp;gt;-cwnd.dat&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;- Gnuplot script: plot-comparison.plt&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;\nTo generate graphs, run:&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;  gnuplot plot-comparison.plt&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;\nTo view animation, run:&quot; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &quot;  ./netanim tcp-&amp;lt;variant&amp;gt;-animation.xml&quot; &amp;lt;&amp;lt; std::endl;

    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Animation Screenshot&lt;/h2&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;img height=&quot;311&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiZhsC810-SQCVnJLvfcCqZ5zVi8nQX5pgpnafhAoTq5Z5ivZ2k18ZF2q1IobhlM1vTqq0j7YQ_vcDN2KQYj6DPdi358pTOroulAVCL4b7YETW28A9YjsAIMiNqogFmDTsMUqMQlaeg77D3rQebtLDLY7ZnryVUO_WZnP96ROg2eQXGqC9xHrHigQhg7uw&quot; style=&quot;margin-left: auto; margin-right: auto; max-width: 100%;&quot; width=&quot;453&quot; alt=&quot;NetAnim Topology View&quot; /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;NetAnim Topology View&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;img height=&quot;339&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiEme5giO8FD-KppAM8ZOeRw1unbgLtldMYDwJGXsG00cloEge0qn_7HZAtoKKnaJlF75W8JTkqZn_RJu_100ciQ40q6TiPvqFnhZY8Fn_OF9IcX_LAwGe_YRyJtD1VBUv3GD2O-FpWbVHZBbk5qO3zm9qfcUR9riFuz8HAW9OhFCYEMtvL_ZAKodKWMo8&quot; style=&quot;margin-left: auto; margin-right: auto; max-width: 100%;&quot; width=&quot;602&quot; alt=&quot;NetAnim Packet Flow&quot; /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;NetAnim Packet Flow&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Figure 1: NetAnim Visualization of TCP Communication&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 1.6;&quot;&gt;
  This animation shows the wired dumbbell topology with four nodes: Sender (green), Router1 (blue), Router2 (blue), and Receiver (red). The packet flow is visible between the sender and receiver nodes. The bottleneck link between Router1 and Router2 experiences 5% random packet loss, causing TCP to repeatedly detect congestion and adjust its sending rate. The animation clearly shows packet drops occurring at the bottleneck link.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Graph Screenshot&lt;/h2&gt;
&lt;h3&gt;Throughput Comparison Graph&lt;/h3&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;img height=&quot;323&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj-w1zdQSXujbZR0uFIuwVGIRE-vFUHIt_LfS50OumzuwqqrYFcdWGRoGGy5_FpmlrOXfkbZ5M35D4GP2HRPtYXbBMsqAcppO79Mxnnrd2kwwkpvwNpFo0jIdV5m4D-MuOXFr4XAK9qLedlGCl_k2lHHdf8164uX5tWBe7Cavi4PrQX0h0blioe3hUjaOk&quot; style=&quot;margin-left: auto; margin-right: auto; max-width: 100%;&quot; width=&quot;602&quot; alt=&quot;TCP Throughput Comparison&quot; /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Figure 2: TCP Throughput Comparison under 5% Random Packet Loss&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p style=&quot;line-height: 1.6;&quot;&gt;
  This graph compares the throughput (in Mbps) of all four TCP variants over the 30-second simulation period. Key observations:
&lt;/p&gt;
&lt;ul style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;TCP Cubic&lt;/strong&gt; shows the highest average throughput due to its aggressive window growth algorithm, though with significant fluctuations.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TCP NewReno&lt;/strong&gt; demonstrates more stable throughput than Reno due to improved fast recovery.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TCP Reno&lt;/strong&gt; exhibits frequent throughput drops as it struggles with multiple packet losses.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TCP Vegas&lt;/strong&gt; maintains the most consistent but lower throughput, as its delay-based approach prevents aggressive probing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;Congestion Window Comparison Graph&lt;/h3&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;img height=&quot;402&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhml4numA3CR2PAeiBZGFPIIaQLYkFyujOWP67NXqy0PTFdwvoaQoQc9QNUpH9pBuFCehp1KnfENu0HxQtjEFk626yovsxXDUmTJ2rrwJUAhcfXMqx5O6bZ25tXXtEu6AsrYYEAlwOPkHur3WcUkNLD7Ub7CbMkLLA-4SwN_-ikpmJWlb-Zkjy43Kagt7g&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;602&quot; alt=&quot;TCP Congestion Window Evolution&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3: TCP Congestion Window Evolution under 5% Packet Loss&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 1.6;&quot;&gt;
  This graph illustrates the congestion window dynamics of each TCP variant:
&lt;/p&gt;
&lt;ul style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;TCP Cubic&lt;/strong&gt; achieves the largest congestion window but shows sharp sawtooth patterns due to loss detection.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TCP NewReno&lt;/strong&gt; maintains moderate window sizes with gradual recovery after losses.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TCP Reno&lt;/strong&gt; shows classical AIMD behavior with frequent window reductions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;TCP Vegas&lt;/strong&gt; keeps consistently small windows, prioritizing stability over throughput.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Results Summary Table&lt;/h2&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;8&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 100%; text-align: left;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #f2f2f2;&quot;&gt;
      &lt;th&gt;TCP Variant&lt;/th&gt;
      &lt;th&gt;Avg Throughput (Mbps)&lt;/th&gt;
      &lt;th&gt;Packet Loss Ratio&lt;/th&gt;
      &lt;th&gt;Mean Delay (ms)&lt;/th&gt;
      &lt;th&gt;Stability&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Reno&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;~3.2&lt;/td&gt;
      &lt;td&gt;~8%&lt;/td&gt;
      &lt;td&gt;~45&lt;/td&gt;
      &lt;td&gt;Low&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;NewReno&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;~4.1&lt;/td&gt;
      &lt;td&gt;~7%&lt;/td&gt;
      &lt;td&gt;~42&lt;/td&gt;
      &lt;td&gt;Medium&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Cubic&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;~4.8&lt;/td&gt;
      &lt;td&gt;~9%&lt;/td&gt;
      &lt;td&gt;~50&lt;/td&gt;
      &lt;td&gt;Medium&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;Vegas&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;~2.5&lt;/td&gt;
      &lt;td&gt;~5%&lt;/td&gt;
      &lt;td&gt;~35&lt;/td&gt;
      &lt;td&gt;High&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;Analysis and Conclusions&lt;/h2&gt;
&lt;ol style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;Throughput Performance:&lt;/strong&gt; TCP Cubic achieves the highest throughput due to its aggressive window increase function, but this comes at the cost of higher packet loss rates and delays.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Loss Recovery:&lt;/strong&gt; NewReno significantly outperforms Reno in scenarios with multiple packet losses within a single window, demonstrating the importance of improved fast recovery mechanisms.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Delay-Based vs Loss-Based:&lt;/strong&gt; TCP Vegas, being delay-based, maintains lower queue occupancy and experiences the lowest actual packet loss. However, it achieves lower throughput as it backs off before the network is fully saturated.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fairness Considerations:&lt;/strong&gt; In mixed environments, Vegas would likely be starved by more aggressive variants like Cubic, highlighting the importance of algorithm selection in shared networks.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;5% Loss Impact:&lt;/strong&gt; The 5% random packet loss significantly impacts all loss-based TCP variants, causing them to interpret random losses as congestion signals and repeatedly reduce their sending rates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/8799298456622058711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/tcp-reno-newreno-cubic-and-vegas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8799298456622058711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/8799298456622058711'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/tcp-reno-newreno-cubic-and-vegas.html' title='TCP Reno, NewReno, Cubic, and Vegas Comparison under 5% Random Packet Loss in Wired Topology | NS3 Project 23'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiZhsC810-SQCVnJLvfcCqZ5zVi8nQX5pgpnafhAoTq5Z5ivZ2k18ZF2q1IobhlM1vTqq0j7YQ_vcDN2KQYj6DPdi358pTOroulAVCL4b7YETW28A9YjsAIMiNqogFmDTsMUqMQlaeg77D3rQebtLDLY7ZnryVUO_WZnP96ROg2eQXGqC9xHrHigQhg7uw=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-1891129558949161327</id><published>2026-08-13T08:45:00.000+05:30</published><updated>2026-09-08T15:13:50.726+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Transport Layer &amp; TCP Variants: Analyze TCP goodput vs. offered load in a 10 Gbps link with controlled packet loss | NS3 Project 22</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Transport Layer &amp;amp; TCP Variants: Analyze TCP Goodput vs. Offered Load in a 10 Gbps Link with Controlled Packet Loss | NS3 Project 22&lt;/h1&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;&lt;u&gt;Aim:&lt;/u&gt;&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  To analyze &lt;strong&gt;TCP goodput vs. offered load&lt;/strong&gt; over a &lt;strong&gt;10 Gbps link&lt;/strong&gt; under &lt;strong&gt;controlled packet loss conditions&lt;/strong&gt;, using NS-3 simulation. The goal is to observe how increasing offered load impacts actual useful throughput (goodput) for different TCP variants. Also visualize packet flow using &lt;strong&gt;NetAnim&lt;/strong&gt;.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;&lt;u&gt;Network Topology:&lt;/u&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Two nodes:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;n0 &amp;rarr; Sender&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;n1 &amp;rarr; Receiver&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Link Characteristics:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Bandwidth: &lt;strong&gt;10 Gbps&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Delay: &lt;strong&gt;2 ms&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;Traffic Type: &lt;strong&gt;TCP Bulk transfer with controlled packet loss&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;pre style=&quot;background-color: #f4f4f4; padding: 10px; border-left: 4px solid #007acc; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 14px;&quot;&gt;
n0 ---------------------- n1
     10 Gbps, 2 ms delay
&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;&lt;u&gt;Code:&lt;/u&gt;&lt;/h2&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code class=&quot;language-cpp&quot;&gt;#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/error-model.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/netanim-module.h&quot;
#include &amp;lt;fstream&amp;gt;
#include &amp;lt;string&amp;gt;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE (&quot;TcpGoodputExample&quot;);

double RunSimulation(double loadGbps)
{
    NodeContainer nodes;
    nodes.Create(2);

    Config::SetDefault(&quot;ns3::TcpSocket::SegmentSize&quot;, UintegerValue(8960));
    Config::SetDefault(&quot;ns3::TcpSocket::RcvBufSize&quot;, UintegerValue(1 &amp;lt;&amp;lt; 26)); // 64MB
    Config::SetDefault(&quot;ns3::TcpSocket::SndBufSize&quot;, UintegerValue(1 &amp;lt;&amp;lt; 26)); // 64MB
    Config::SetDefault(&quot;ns3::TcpSocketBase::WindowScaling&quot;, BooleanValue(true));
    Config::SetDefault(&quot;ns3::TcpL4Protocol::SocketType&quot;, StringValue(&quot;ns3::TcpNewReno&quot;));
    // Config::SetDefault(&quot;ns3::TcpL4Protocol::SocketType&quot;, TypeIdValue(TcpCubic::GetTypeId())); // or Bbr

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&quot;DataRate&quot;, StringValue(&quot;10Gbps&quot;));
    p2p.SetChannelAttribute(&quot;Delay&quot;, StringValue(&quot;2ms&quot;));
    p2p.SetQueue(&quot;ns3::DropTailQueue&quot;, &quot;MaxSize&quot;, StringValue(&quot;30000p&quot;));
    NetDeviceContainer devices = p2p.Install(nodes);

    // --- Controlled Packet Loss ---
    Ptr&amp;lt;RateErrorModel&amp;gt; em = CreateObject&amp;lt;RateErrorModel&amp;gt;();
    em-&amp;gt;SetAttribute(&quot;ErrorRate&quot;, DoubleValue(10e-9));
    devices.Get(1)-&amp;gt;SetAttribute(&quot;ReceiveErrorModel&quot;, PointerValue(em));

    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.0&quot;);
    Ipv4InterfaceContainer interfaces = address.Assign(devices);

    uint16_t port = 8080;

    // --- Sink Application (Receiver) ---
    PacketSinkHelper sinkHelper(&quot;ns3::TcpSocketFactory&quot;,
                                InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApp = sinkHelper.Install(nodes.Get(1));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(30.0));

    // --- Source Application (Sender) ---
    OnOffHelper sourceHelper(&quot;ns3::TcpSocketFactory&quot;,
                            InetSocketAddress(interfaces.GetAddress(1), port));

    std::ostringstream rate;
    rate &amp;lt;&amp;lt; loadGbps &amp;lt;&amp;lt; &quot;Gbps&quot;;
    sourceHelper.SetAttribute(&quot;DataRate&quot;, StringValue(rate.str()));
    sourceHelper.SetAttribute(&quot;PacketSize&quot;, UintegerValue(8960));
    sourceHelper.SetAttribute(&quot;OnTime&quot;, StringValue(&quot;ns3::ConstantRandomVariable[Constant=1]&quot;));
    sourceHelper.SetAttribute(&quot;OffTime&quot;, StringValue(&quot;ns3::ConstantRandomVariable[Constant=0]&quot;));

    ApplicationContainer sourceApp = sourceHelper.Install(nodes.Get(0));
    sourceApp.Start(Seconds(1.0)); // Starts at 1s
    sourceApp.Stop(Seconds(30.0)); // Stops at 30s

    // --- Simulation Execution ---
    Simulator::Stop(Seconds(30.1));
    Simulator::Run();

    // --- Goodput Calculation ---
    // We access the Sink application directly to see how many bytes were delivered
    Ptr&amp;lt;PacketSink&amp;gt; sink = DynamicCast&amp;lt;PacketSink&amp;gt;(sinkApp.Get(0));
    uint64_t totalBytesReceived = sink-&amp;gt;GetTotalRx();

    // Duration is 29 seconds (from 1.0 to 30.0)
    double duration = 29.0;
    double goodputGbps = (totalBytesReceived * 8.0) / (duration * 1e9);

    Simulator::Destroy();
    return goodputGbps;
}

int main(int argc, char *argv[])
{
    std::ofstream outFile;
    outFile.open(&quot;load_vs_goodput.dat&quot;, std::ios::trunc);
    outFile &amp;lt;&amp;lt; &quot;# Load(Gbps) Goodput(Gbps)&quot; &amp;lt;&amp;lt; std::endl;

    double loads[] = {1, 2, 4, 6, 8, 10};

    for (double load : loads)
    {
        std::cout &amp;lt;&amp;lt; &quot;Running simulation for Load: &quot; &amp;lt;&amp;lt; load &amp;lt;&amp;lt; &quot; Gbps...&quot; &amp;lt;&amp;lt; std::flush;
        double goodput = RunSimulation(load);
        outFile &amp;lt;&amp;lt; load &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; goodput &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; &quot; Done. Goodput: &quot; &amp;lt;&amp;lt; goodput &amp;lt;&amp;lt; &quot; Gbps&quot; &amp;lt;&amp;lt; std::endl;
    }

    outFile.close();
    std::cout &amp;lt;&amp;lt; &quot;\nResults saved to load_vs_goodput.dat\n&quot;;
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;&lt;u&gt;Output:&lt;/u&gt;&lt;/h2&gt;

&lt;h3&gt;&lt;strong&gt;tcpnewreno:&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;clear: both; text-align: center;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgAuXnNT1TPc2QVlgNv9FEUMz6Cy3R_jup70HT5Upy85nmknh1Nj4c1fmbWJaQmgASfMLEqLGrNc6u-g4sQqb_XcEHKIpTnrzzd9h1zEfkge95pCrd6dHmz7UMDQJjLgZxBm6epQYVICk2Nr6kle0t9pplx1tuYU5BH-sj7qGcz_STCugMv0k2gARWnYVk&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;TCP NewReno Output Terminal&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgAuXnNT1TPc2QVlgNv9FEUMz6Cy3R_jup70HT5Upy85nmknh1Nj4c1fmbWJaQmgASfMLEqLGrNc6u-g4sQqb_XcEHKIpTnrzzd9h1zEfkge95pCrd6dHmz7UMDQJjLgZxBm6epQYVICk2Nr6kle0t9pplx1tuYU5BH-sj7qGcz_STCugMv0k2gARWnYVk=w640-h228&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 12px; border-radius: 6px; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.4;&quot;&gt;&lt;code&gt;# Load(Gbps) Goodput(Gbps)
1 0.953423
2 1.35257
4 1.31719
6 1.24898
8 1.14828
10 1.26265&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;tcpcubic:&lt;/strong&gt;&lt;/h3&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjOX2LYON9MLR8BNQNMZHqw7Bgepi5v2ShXG-7MmLVN7qpjDLccx1x136-hWOAocLYqTG9xgZ1o0LkZbvhrrMzXLrZhG1h5dB9EKYj0F5tzFRtceYyzDiEc7BDXl54llPfJKWS6kxV4X3je3ewVwmKXtRdSpMKNeLl0VxrTbsEU28oN-39ww3H8AdsurC0&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
          &lt;img alt=&quot;TCP Cubic Output Terminal&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjOX2LYON9MLR8BNQNMZHqw7Bgepi5v2ShXG-7MmLVN7qpjDLccx1x136-hWOAocLYqTG9xgZ1o0LkZbvhrrMzXLrZhG1h5dB9EKYj0F5tzFRtceYyzDiEc7BDXl54llPfJKWS6kxV4X3je3ewVwmKXtRdSpMKNeLl0VxrTbsEU28oN-39ww3H8AdsurC0=w640-h228&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;640&quot; /&gt;
        &lt;/a&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 12px; border-radius: 6px; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.4;&quot;&gt;&lt;code&gt;# Load(Gbps) Goodput(Gbps)
1 0.999862
2 1.9007
4 1.81446
6 1.67706
8 1.74666
10 1.80455&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;tcpbbr:&lt;/strong&gt;&lt;/h3&gt;
&lt;div style=&quot;clear: both; text-align: center;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiIRi8cNgNOyPA4OJcdqYmuNsJwcjpDoKf6cGN-7aW09azFnmLj-H1lQHvdSSOnVwXHfo8c1smvjMyyLCywpk4mcYxUc3wieHjlG-U-2d4y-DkYwpmOS_P2UipUaoJMdZT0g2B0CKQBhaSwTJxD8ihSxGnmrifB5vS3Bl4UOh9SV7jP6lR62qfY5d2DACU&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;TCP BBR Output Terminal&quot; height=&quot;206&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiIRi8cNgNOyPA4OJcdqYmuNsJwcjpDoKf6cGN-7aW09azFnmLj-H1lQHvdSSOnVwXHfo8c1smvjMyyLCywpk4mcYxUc3wieHjlG-U-2d4y-DkYwpmOS_P2UipUaoJMdZT0g2B0CKQBhaSwTJxD8ihSxGnmrifB5vS3Bl4UOh9SV7jP6lR62qfY5d2DACU=w640-h206&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 12px; border-radius: 6px; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.4;&quot;&gt;&lt;code&gt;# Load(Gbps) Goodput(Gbps)
1 0.999862
2 1.99972
4 3.99942
6 4.00503
8 4.00497
10 4.00574&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;&lt;u&gt;Graph:&lt;/u&gt;&lt;/h2&gt;
&lt;div style=&quot;clear: both; text-align: center;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiZgIZ21V443W7wE9Tt3-xxG12WlDbaqEOvwIrbCF7DV0qAQVByvQBkHTSCKCrQeX6px7YKlaMIqMdFKaW3JlKFZPDzZDrvWXxUY0fd4ljvxJt6IOr0Q10jWa9F1hNBVkeBAk-wXD3waeC8I0C8DGhaN8YWcibcDWdqWJFBcxS9KNbDDm7FE1PHZOZwm1M&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;Load vs Goodput Graph&quot; height=&quot;482&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiZgIZ21V443W7wE9Tt3-xxG12WlDbaqEOvwIrbCF7DV0qAQVByvQBkHTSCKCrQeX6px7YKlaMIqMdFKaW3JlKFZPDzZDrvWXxUY0fd4ljvxJt6IOr0Q10jWa9F1hNBVkeBAk-wXD3waeC8I0C8DGhaN8YWcibcDWdqWJFBcxS9KNbDDm7FE1PHZOZwm1M=w640-h482&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;da3.plt (Gnuplot Script):&lt;/strong&gt;&lt;/h3&gt;
&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code class=&quot;language-gnuplot&quot;&gt;set terminal png
set output &#39;graph.png&#39;
set title &quot;Load vs Goodput&quot;
set xlabel &quot;Offered Load (Gbps)&quot;
set ylabel &quot;Goodput (Gbps)&quot;

plot &quot;load_vs_goodput.dat&quot; with linespoints title &quot;NewReno&quot;, \
     &quot;load_vs_goodput2.dat&quot; with linespoints title &quot;Cubic&quot;, \
     &quot;load_vs_goodput3.dat&quot; with linespoints title &quot;BBR&quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;&lt;u&gt;Inference:&lt;/u&gt;&lt;/h2&gt;

&lt;h3&gt;1. The &quot;Linear Scaling&quot; Region&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  At the 1 Gbps mark, the graph shows all three protocols overlapping almost perfectly.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
    &lt;strong&gt;Analysis:&lt;/strong&gt; When the offered load is low, the time between packet loss events is long enough for even the most conservative loss-based protocol (NewReno) to recover and deliver 100% of the traffic. At this stage, performance is limited by the Application Source rate, not by network congestion or protocol limits.
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;2. The Efficiency Divergence (The &quot;Ceiling&quot; Effect)&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  As the load surpasses 2 Gbps, a sharp divergence emerges. This plateau represents the maximum steady-state throughput each protocol can maintain under a non-zero bit error rate (BER):
&lt;/p&gt;
&lt;ul&gt;
  &lt;li style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
    &lt;strong&gt;NewReno (The Floor):&lt;/strong&gt; Stabilizes at ~1.3 Gbps. The standard linear Additive Increase (AIMD) is too slow to reclaim the 10 Gbps pipe before the next random loss occurs, leaving it trapped in frequent recovery cycles.
  &lt;/li&gt;
  &lt;li style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
    &lt;strong&gt;Cubic (The Middle Ground):&lt;/strong&gt; Stabilizes at ~1.8 &amp;ndash; 1.9 Gbps. Using a cubic window growth function allows it to ramp up faster than NewReno. However, because it still treats packet loss as congestion, random link errors cause unnecessary window reductions.
  &lt;/li&gt;
  &lt;li style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
    &lt;strong&gt;BBR (The Leader):&lt;/strong&gt; Stabilizes at ~4.0 Gbps. Because BBR models the network path (estimated bottleneck bandwidth and minimum RTT) rather than halving its window on individual packet losses, it ignores non-congestive bit errors. Its ceiling here is constrained by the BDP/socket buffer limits rather than error rate sensitivity.
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;3. Saturation and &quot;Congestive Collapse&quot;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Looking at the 8 Gbps to 10 Gbps range on the graph, there is a slight downward trend in Goodput for NewReno and Cubic.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
    &lt;strong&gt;Analysis:&lt;/strong&gt; As the offered load increases, more packets are injected per second. Statistically, a constant packet error rate results in a higher absolute number of packet drops per unit time.
  &lt;/li&gt;
  &lt;li style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
    &lt;strong&gt;Inference:&lt;/strong&gt; For loss-based protocols (NewReno/Cubic), more frequent packet drop triggers mean more frequent window-halving events. Consequently, the protocol spends more time in recovery than in steady transmission, causing goodput to plateau or degrade as offered load increases.
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;&lt;strong&gt;Key Takeaway:&lt;/strong&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The simulation demonstrates that raw link bandwidth alone does not guarantee high throughput—congestion control logic plays the decisive role:
&lt;/p&gt;
&lt;ol style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;NewReno&lt;/strong&gt; is severely limited on high-speed (10 Gbps) links in the presence of random packet loss.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Cubic&lt;/strong&gt; improves performance over NewReno, but still underutilizes high-bandwidth links when packet losses are non-congestive.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;BBR&lt;/strong&gt; sustains significantly higher goodput in lossy high-speed environments by decoupling congestion estimation from loss detection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/1891129558949161327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/transport-layer-tcp-variants-analyze.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/1891129558949161327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/1891129558949161327'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/transport-layer-tcp-variants-analyze.html' title='Transport Layer &amp; TCP Variants: Analyze TCP goodput vs. offered load in a 10 Gbps link with controlled packet loss | NS3 Project 22'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgAuXnNT1TPc2QVlgNv9FEUMz6Cy3R_jup70HT5Upy85nmknh1Nj4c1fmbWJaQmgASfMLEqLGrNc6u-g4sQqb_XcEHKIpTnrzzd9h1zEfkge95pCrd6dHmz7UMDQJjLgZxBm6epQYVICk2Nr6kle0t9pplx1tuYU5BH-sj7qGcz_STCugMv0k2gARWnYVk=s72-w640-h228-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-6759036038119768296</id><published>2026-08-12T08:40:21.658+05:30</published><updated>2026-09-08T15:16:17.694+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Simulation of a Client Server Video-on-Demand (VoD) System Using TCP Socket Factory | NS3 Project 21</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Simulation of a Client Server Video-on-Demand (VoD) System Using TCP Socket Factory | NS3 Project&lt;/h1&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;1. Aim&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  To simulate a client-server Video-on-Demand (VoD) system in NS-3 using the TCP Socket Factory for reliable video stream transport and the Flow Monitor module to measure and analyse key network performance metrics including throughput, end-to-end delay, jitter, and packet loss ratio across two simultaneous client streams.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;2. Introduction&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Video-on-Demand (VoD) is a media distribution paradigm that allows users to access video content at any time on demand. Services such as Netflix, YouTube, and Amazon Prime Video rely on robust network transport protocols to stream high-quality video to end users. Simulating such systems helps network engineers understand bottleneck behaviour, TCP fairness, and QoS characteristics under controlled conditions.
&lt;/p&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  NS-3 (Network Simulator 3) is an open-source discrete-event network simulator widely used in academic research. It provides TCP/IP stack implementations, application helpers such as &lt;code&gt;BulkSendApplication&lt;/code&gt; and &lt;code&gt;PacketSinkApplication&lt;/code&gt;, and analysis tools including the Flow Monitor. In this exercise, NS-3 models a VoD streaming scenario with a server simultaneously streaming to two clients over point-to-point links with a bottleneck router in between.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;3. Theory&lt;/h2&gt;

&lt;h3&gt;3.1 TCP Socket Factory (&lt;code&gt;TcpSocketFactory&lt;/code&gt;)&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The &lt;code&gt;TcpSocketFactory&lt;/code&gt; is an NS-3 abstraction that enables application-layer code to create TCP sockets without being tied to a specific TCP implementation. It uses the &lt;code&gt;TypeId&lt;/code&gt; system, allowing easy switching between TCP variants such as &lt;code&gt;TcpNewReno&lt;/code&gt;, &lt;code&gt;TcpCubic&lt;/code&gt;, or &lt;code&gt;TcpVegas&lt;/code&gt; at runtime without modifying application code. In this simulation, &lt;code&gt;TcpNewReno&lt;/code&gt; is selected. The server calls &lt;code&gt;TcpSocketFactory&lt;/code&gt; to open TCP connections to each client, and bulk data is sent once the three-way handshake completes.
&lt;/p&gt;

&lt;h3&gt;3.2 Flow Monitor Module&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The &lt;code&gt;FlowMonitorHelper&lt;/code&gt; installs passive sniffers on every node. It classifies packets into flows using their 5-tuple (source IP, destination IP, source port, destination port, protocol) and records the following per-flow statistics:
&lt;/p&gt;
&lt;ul style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;Throughput (Mbps):&lt;/strong&gt; Total received bytes &amp;times; 8 divided by flow duration.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;End-to-End Delay (ms):&lt;/strong&gt; Mean packet delay from sender to receiver averaged over all packets.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Jitter (ms):&lt;/strong&gt; Mean variation in inter-packet arrival time — critical for video stream quality.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Packet Loss (%):&lt;/strong&gt; Ratio of lost packets to transmitted packets due to queue overflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;4. Network Design &amp;amp; Topology&lt;/h2&gt;
&lt;p&gt;The simulated topology models a realistic VoD delivery network:&lt;/p&gt;

&lt;pre style=&quot;background-color: #f4f4f4; padding: 12px; border-left: 4px solid #007acc; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 14px; line-height: 1.5;&quot;&gt;
[VoD Server] ── 10 Mbps / 2 ms ── [Router] ── 5 Mbps / 5 ms ── [Client 0]
                                             └── 5 Mbps / 5 ms ── [Client 1]
&lt;/pre&gt;

&lt;ul style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;Nodes:&lt;/strong&gt; 1 VoD Server (Node 0, 10.1.1.1), 1 Router (Node 1), Client 0 (Node 2, 10.1.2.2), Client 1 (Node 3, 10.1.3.2)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Backbone Link:&lt;/strong&gt; Server to Router — 10 Mbps, 2 ms delay, 100-packet DropTail queue&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Access Links:&lt;/strong&gt; Router to each Client — 5 Mbps, 5 ms delay, 50-packet DropTail queue&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Transport Layer:&lt;/strong&gt; TCP NewReno, segment size 1448 bytes, 1 MB send/receive buffers&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Applications:&lt;/strong&gt; &lt;code&gt;BulkSendApplication&lt;/code&gt; (server) sending to &lt;code&gt;PacketSinkApplication&lt;/code&gt; (each client)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Simulation Duration:&lt;/strong&gt; 20 seconds total. Streaming starts at t=1.0s and stops at t=19.0s.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;5. Prompt Used &amp;amp; LLM&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LLM Used:&lt;/strong&gt; Claude by Anthropic (claude.ai)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prompt Given:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background: #f9f9f9; border-left: 4px solid #ccc; margin: 1em 0; padding: 10px 16px; font-style: italic; line-height: 1.6;&quot;&gt;
  &quot;Write a complete NS-3 C++ simulation (scratch/24bps1149.cc) for a client-server VoD system. Use TcpSocketFactory with TcpNewReno, BulkSendApplication on server and PacketSinkApplication on two clients. Set backbone to 10 Mbps / 2 ms and access links to 5 Mbps / 5 ms. Install FlowMonitorHelper on all nodes. Output NetAnim XML, write per-flow throughput .dat files every 0.5s, and print a formatted flow statistics table to the terminal. Simulation time: 20 seconds.&quot;
&lt;/blockquote&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;6. Source Code&lt;/h2&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow-x: auto; font-family: &#39;Consolas&#39;, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 1.5;&quot;&gt;&lt;code class=&quot;language-cpp&quot;&gt;/*
 * Run Command: ./ns3 run scratch/vod.cc
 *
 * Topology:
 *   [VoD Server] ----P2P (10Mbps, 2ms)---- [Router] ----P2P (5Mbps, 5ms)---- [VoD Client 0]
 *                                                  \---P2P (5Mbps, 5ms)---- [VoD Client 1]
 *
 * Description:
 *   - Server streams bulk video data to two clients using TCP (NewReno)
 *   - BulkSendApplication simulates continuous video streaming on server
 *   - PacketSinkApplication receives data on each client
 *   - FlowMonitor captures throughput, delay, loss, jitter per flow
 *   - NetAnim XML generated for animation visualization
 *   - Gnuplot-compatible throughput data written to .dat files
 */

#include &quot;ns3/core-module.h&quot;
#include &quot;ns3/network-module.h&quot;
#include &quot;ns3/internet-module.h&quot;
#include &quot;ns3/point-to-point-module.h&quot;
#include &quot;ns3/applications-module.h&quot;
#include &quot;ns3/flow-monitor-module.h&quot;
#include &quot;ns3/netanim-module.h&quot;
#include &quot;ns3/traffic-control-module.h&quot;
#include &amp;lt;fstream&amp;gt;
#include &amp;lt;iomanip&amp;gt;
#include &amp;lt;map&amp;gt;

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(&quot;VoDSimulation&quot;);

// ─── Global throughput tracking ─────────────────────────────────────────────
std::map&amp;lt;uint32_t, std::ofstream*&amp;gt; g_throughputFiles;
std::map&amp;lt;uint32_t, uint64_t&amp;gt;       g_lastRxBytes;
Ptr&amp;lt;FlowMonitor&amp;gt;                   g_monitor;
FlowMonitorHelper                  g_flowHelper;

// Called every 0.5s to record per-flow throughput
void RecordThroughput()
{
    g_monitor-&amp;gt;CheckForLostPackets();
    auto stats = g_monitor-&amp;gt;GetFlowStats();
    for (auto&amp;amp; kv : stats)
    {
        uint32_t id = kv.first;
        uint64_t rxNow = kv.second.rxBytes;
        uint64_t prev  = g_lastRxBytes[id];
        double   tput  = (rxNow - prev) * 8.0 / 0.5 / 1e6; // Mbps over 0.5s window
        g_lastRxBytes[id] = rxNow;

        if (g_throughputFiles.count(id))
        {
            *g_throughputFiles[id] &amp;lt;&amp;lt; Simulator::Now().GetSeconds()
                                   &amp;lt;&amp;lt; &quot;\t&quot; &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(4)
                                   &amp;lt;&amp;lt; tput &amp;lt;&amp;lt; &quot;\n&quot;;
        }
    }
    Simulator::Schedule(Seconds(0.5), &amp;amp;RecordThroughput);
}

// ─── Main ────────────────────────────────────────────────────────────────────
int main(int argc, char* argv[])
{
    // ── Simulation parameters ──────────────────────────────────────────────
    double   simTime      = 20.0;   // seconds
    uint32_t numClients   = 2;
    uint32_t serverPort   = 9;
    uint64_t maxBytes     = 0;      // 0 = unlimited (stream until simTime)

    std::string tcpVariant     = &quot;ns3::TcpNewReno&quot;;
    std::string backboneBw     = &quot;10Mbps&quot;;
    std::string backboneDelay  = &quot;2ms&quot;;
    std::string accessBw       = &quot;5Mbps&quot;;
    std::string accessDelay    = &quot;5ms&quot;;

    CommandLine cmd;
    cmd.AddValue(&quot;simTime&quot;,    &quot;Simulation duration (s)&quot;,     simTime);
    cmd.AddValue(&quot;numClients&quot;, &quot;Number of VoD clients&quot;,       numClients);
    cmd.AddValue(&quot;tcpVariant&quot;, &quot;TCP congestion control type&quot;, tcpVariant);
    cmd.Parse(argc, argv);

    // ── TCP configuration ──────────────────────────────────────────────────
    Config::SetDefault(&quot;ns3::TcpL4Protocol::SocketType&quot;, StringValue(tcpVariant));
    Config::SetDefault(&quot;ns3::TcpSocket::SegmentSize&quot;,   UintegerValue(1448));
    Config::SetDefault(&quot;ns3::TcpSocket::SndBufSize&quot;,    UintegerValue(1 &amp;lt;&amp;lt; 20)); // 1 MB
    Config::SetDefault(&quot;ns3::TcpSocket::RcvBufSize&quot;,    UintegerValue(1 &amp;lt;&amp;lt; 20));

    // ── Create nodes ───────────────────────────────────────────────────────
    NodeContainer serverNode;   serverNode.Create(1);           // n0
    NodeContainer routerNode;   routerNode.Create(1);           // n1
    NodeContainer clientNodes;  clientNodes.Create(numClients); // n2, n3, ...

    // ── Point-to-Point links ───────────────────────────────────────────────
    PointToPointHelper backbone;
    backbone.SetDeviceAttribute (&quot;DataRate&quot;, StringValue(backboneBw));
    backbone.SetChannelAttribute(&quot;Delay&quot;,    StringValue(backboneDelay));
    backbone.SetQueue(&quot;ns3::DropTailQueue&quot;, &quot;MaxSize&quot;, StringValue(&quot;100p&quot;));

    PointToPointHelper access;
    access.SetDeviceAttribute (&quot;DataRate&quot;, StringValue(accessBw));
    access.SetChannelAttribute(&quot;Delay&quot;,    StringValue(accessDelay));
    access.SetQueue(&quot;ns3::DropTailQueue&quot;, &quot;MaxSize&quot;, StringValue(&quot;50p&quot;));

    // Server &lt;-&gt; Router
    NetDeviceContainer serverRouterDev = backbone.Install(serverNode.Get(0), routerNode.Get(0));

    // Router &lt;-&gt; each Client
    std::vector&amp;lt;NetDeviceContainer&amp;gt; clientDevs(numClients);
    for (uint32_t i = 0; i &amp;lt; numClients; ++i)
    {
        clientDevs[i] = access.Install(routerNode.Get(0), clientNodes.Get(i));
    }

    // ── Internet stack ─────────────────────────────────────────────────────
    InternetStackHelper internet;
    internet.Install(serverNode);
    internet.Install(routerNode);
    internet.Install(clientNodes);

    // ── IP addressing ──────────────────────────────────────────────────────
    Ipv4AddressHelper ipv4;

    // 10.1.1.0/30 — backbone
    ipv4.SetBase(&quot;10.1.1.0&quot;, &quot;255.255.255.252&quot;);
    Ipv4InterfaceContainer serverRouterIf = ipv4.Assign(serverRouterDev);

    // 10.1.2.0/30, 10.1.3.0/30, ... — access links
    std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; clientIf(numClients);
    for (uint32_t i = 0; i &amp;lt; numClients; ++i)
    {
        std::ostringstream base;
        base &amp;lt;&amp;lt; &quot;10.1.&quot; &amp;lt;&amp;lt; (i + 2) &amp;lt;&amp;lt; &quot;.0&quot;;
        ipv4.SetBase(base.str().c_str(), &quot;255.255.255.252&quot;);
        clientIf[i] = ipv4.Assign(clientDevs[i]);
    }

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    // ── Applications ───────────────────────────────────────────────────────
    // PacketSink on every client
    for (uint32_t i = 0; i &amp;lt; numClients; ++i)
    {
        PacketSinkHelper sink(&quot;ns3::TcpSocketFactory&quot;,
                              InetSocketAddress(Ipv4Address::GetAny(), serverPort + i));
        ApplicationContainer sinkApp = sink.Install(clientNodes.Get(i));
        sinkApp.Start(Seconds(0.0));
        sinkApp.Stop(Seconds(simTime));
    }

    // BulkSend from server to each client (separate TCP connection per client)
    for (uint32_t i = 0; i &amp;lt; numClients; ++i)
    {
        Ipv4Address clientAddr = clientIf[i].GetAddress(1); // client side of access link
        BulkSendHelper bulk(&quot;ns3::TcpSocketFactory&quot;,
                            InetSocketAddress(clientAddr, serverPort + i));
        bulk.SetAttribute(&quot;MaxBytes&quot;, UintegerValue(maxBytes));
        bulk.SetAttribute(&quot;SendSize&quot;, UintegerValue(1448)); // ~1 video chunk

        ApplicationContainer serverApp = bulk.Install(serverNode.Get(0));
        serverApp.Start(Seconds(1.0)); // slight delay so sink is ready
        serverApp.Stop(Seconds(simTime - 1.0));
    }

    // ── Flow Monitor ───────────────────────────────────────────────────────
    g_monitor = g_flowHelper.InstallAll();

    // Open throughput output files (one per expected flow)
    for (uint32_t i = 1; i &amp;lt;= numClients; ++i)
    {
        std::ostringstream fname;
        fname &amp;lt;&amp;lt; &quot;vod_throughput_flow&quot; &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &quot;.dat&quot;;
        auto* f = new std::ofstream(fname.str());
        *f &amp;lt;&amp;lt; &quot;# Time(s)\tThroughput(Mbps)\n&quot;;
        g_throughputFiles[i] = f;
        g_lastRxBytes[i]     = 0;
    }
    Simulator::Schedule(Seconds(1.5), &amp;amp;RecordThroughput);

    // ── NetAnim ────────────────────────────────────────────────────────────
    AnimationInterface anim(&quot;vod_animation.xml&quot;);

    // Server - left side
    anim.SetConstantPosition(serverNode.Get(0), 10.0, 50.0);
    anim.UpdateNodeDescription(serverNode.Get(0), &quot;VoD Server&quot;);
    anim.UpdateNodeColor(serverNode.Get(0), 255, 0, 0); // red
    anim.UpdateNodeSize(serverNode.Get(0)-&amp;gt;GetId(), 3.0, 3.0);

    // Router - centre
    anim.SetConstantPosition(routerNode.Get(0), 50.0, 50.0);
    anim.UpdateNodeDescription(routerNode.Get(0), &quot;Router&quot;);
    anim.UpdateNodeColor(routerNode.Get(0), 0, 128, 0); // green
    anim.UpdateNodeSize(routerNode.Get(0)-&amp;gt;GetId(), 3.0, 3.0);

    // Clients - right side, spread vertically
    for (uint32_t i = 0; i &amp;lt; numClients; ++i)
    {
        double yPos = 30.0 + i * 40.0;
        anim.SetConstantPosition(clientNodes.Get(i), 90.0, yPos);
        std::ostringstream label;
        label &amp;lt;&amp;lt; &quot;Client &quot; &amp;lt;&amp;lt; i;
        anim.UpdateNodeDescription(clientNodes.Get(i), label.str());
        anim.UpdateNodeColor(clientNodes.Get(i), 0, 0, 255); // blue
        anim.UpdateNodeSize(clientNodes.Get(i)-&amp;gt;GetId(), 3.0, 3.0);
    }

    // ── Run ────────────────────────────────────────────────────────────────
    NS_LOG_UNCOND(&quot;=== VoD Simulation Starting ===&quot;);
    NS_LOG_UNCOND(&quot;  TCP variant  : &quot; &amp;lt;&amp;lt; tcpVariant);
    NS_LOG_UNCOND(&quot;  Backbone     : &quot; &amp;lt;&amp;lt; backboneBw &amp;lt;&amp;lt; &quot; / &quot; &amp;lt;&amp;lt; backboneDelay);
    NS_LOG_UNCOND(&quot;  Access links : &quot; &amp;lt;&amp;lt; accessBw   &amp;lt;&amp;lt; &quot; / &quot; &amp;lt;&amp;lt; accessDelay);
    NS_LOG_UNCOND(&quot;  Clients      : &quot; &amp;lt;&amp;lt; numClients);
    NS_LOG_UNCOND(&quot;  Sim time     : &quot; &amp;lt;&amp;lt; simTime &amp;lt;&amp;lt; &quot; s&quot;);
    NS_LOG_UNCOND(&quot;================================&quot;);

    Simulator::Stop(Seconds(simTime));
    Simulator::Run();

    // ── Flow Monitor Results ───────────────────────────────────────────────
    g_monitor-&amp;gt;CheckForLostPackets();
    g_monitor-&amp;gt;SerializeToXmlFile(&quot;vod_flowmon.xml&quot;, true, true);

    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(g_flowHelper.GetClassifier());
    auto stats = g_monitor-&amp;gt;GetFlowStats();

    NS_LOG_UNCOND(&quot;\n========= Flow Monitor Results =========&quot;);
    NS_LOG_UNCOND(std::left
                  &amp;lt;&amp;lt; std::setw(8)  &amp;lt;&amp;lt; &quot;FlowID&quot;
                  &amp;lt;&amp;lt; std::setw(22) &amp;lt;&amp;lt; &quot;Src -&gt; Dst&quot;
                  &amp;lt;&amp;lt; std::setw(14) &amp;lt;&amp;lt; &quot;Throughput&quot;
                  &amp;lt;&amp;lt; std::setw(14) &amp;lt;&amp;lt; &quot;Mean Delay&quot;
                  &amp;lt;&amp;lt; std::setw(14) &amp;lt;&amp;lt; &quot;Mean Jitter&quot;
                  &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; &quot;Loss %&quot;);

    for (auto&amp;amp; kv : stats)
    {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(kv.first);
        double duration = kv.second.timeLastRxPacket.GetSeconds()
                        - kv.second.timeFirstTxPacket.GetSeconds();
        if (duration &amp;lt;= 0) continue;

        double tput   = kv.second.rxBytes * 8.0 / duration / 1e6; // Mbps
        double delay  = (kv.second.rxPackets &amp;gt; 0)
                        ? kv.second.delaySum.GetSeconds() / kv.second.rxPackets * 1000.0
                        : 0.0; // ms
        double jitter = (kv.second.rxPackets &amp;gt; 1)
                        ? kv.second.jitterSum.GetSeconds() / (kv.second.rxPackets - 1) * 1000.0
                        : 0.0; // ms
        double loss   = (kv.second.txPackets &amp;gt; 0)
                        ? 100.0 * (kv.second.txPackets - kv.second.rxPackets) / kv.second.txPackets
                        : 0.0;

        std::ostringstream flow;
        flow &amp;lt;&amp;lt; t.sourceAddress &amp;lt;&amp;lt; &quot;-&gt;&quot; &amp;lt;&amp;lt; t.destinationAddress;

        NS_LOG_UNCOND(std::left
                      &amp;lt;&amp;lt; std::setw(8)  &amp;lt;&amp;lt; kv.first
                      &amp;lt;&amp;lt; std::setw(22) &amp;lt;&amp;lt; flow.str()
                      &amp;lt;&amp;lt; std::setw(14) &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(3) &amp;lt;&amp;lt; tput &amp;lt;&amp;lt; &quot; Mbps&quot;
                      &amp;lt;&amp;lt; std::setw(14) &amp;lt;&amp;lt; delay  &amp;lt;&amp;lt; &quot; ms&quot;
                      &amp;lt;&amp;lt; std::setw(14) &amp;lt;&amp;lt; jitter &amp;lt;&amp;lt; &quot; ms&quot;
                      &amp;lt;&amp;lt; std::setw(10) &amp;lt;&amp;lt; loss   &amp;lt;&amp;lt; &quot; %&quot;);
    }
    NS_LOG_UNCOND(&quot;========================================&quot;);
    NS_LOG_UNCOND(&quot;NetAnim file     : vod_animation.xml&quot;);
    NS_LOG_UNCOND(&quot;FlowMonitor XML  : vod_flowmon.xml&quot;);
    NS_LOG_UNCOND(&quot;Throughput data  : vod_throughput_flow*.dat&quot;);

    // Close output files
    for (auto&amp;amp; kv : g_throughputFiles)
    {
        kv.second-&amp;gt;close();
        delete kv.second;
    }

    Simulator::Destroy();
    return 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;7. NetAnim Animation Window&lt;/h2&gt;

&lt;h3&gt;7.1 Animator View&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The screenshot below shows the NetAnim Animator tab. The red node (left) is the VoD Server (10.1.1.1), the green node (centre) is the Router, and the two blue nodes (right) are Client 0 (10.1.2.2, upper) and Client 1 (10.1.3.2, lower). The simulation status bar reads &quot;Playing&quot;, confirming the animation is running through the 20-second simulation window.
&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjLJfVAR9WAsl3jPeV2LVJ4AUJz7RDfKWmAQIlZUioaKqckGzDYRIiWQmy9sOBXrxA174-yKZfT1Gd7lMPwXnDQPvcP_EW_cdxmlxWCEWk3l1ELX6ksMByfn0InPdLUpHI720UJOSE08MoC-wskzjtOkQVXfNK3Bi8-i8zg2EzF0QCmhl-LIVMAwe_wjJU&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
          &lt;img alt=&quot;NetAnim Animator Window&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjLJfVAR9WAsl3jPeV2LVJ4AUJz7RDfKWmAQIlZUioaKqckGzDYRIiWQmy9sOBXrxA174-yKZfT1Gd7lMPwXnDQPvcP_EW_cdxmlxWCEWk3l1ELX6ksMByfn0InPdLUpHI720UJOSE08MoC-wskzjtOkQVXfNK3Bi8-i8zg2EzF0QCmhl-LIVMAwe_wjJU=w640-h416&quot; style=&quot;max-width: 100%; height: auto;&quot; width=&quot;640&quot; /&gt;
        &lt;/a&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;em&gt;Fig. 1: NetAnim Animator window — VoD Server (red), Router (green), Client 0 and Client 1 (blue). Packets travel from server through router to both clients.&lt;/em&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h3&gt;7.2 Stats View — IP/MAC Table&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The Stats tab shows the IP and MAC address assignments for all nodes: Node 0 (Server) = 10.1.1.1; Node 1 (Router) has three interfaces (10.1.2.1, 10.1.3.1, 10.1.1.2); Node 2 (Client 0) = 10.1.2.2; and Node 3 (Client 1) = 10.1.3.2. This confirms correct IPv4 global routing across the topology.
&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhj3bsfRcnPqHbjNXw8iHTvGi5Yw5FoA3Rj03evWJ4HhGt2oZdis8OzaHwlnoGy_heCuwEe-Gvdo3yYaxe7Gv--xbSdTzyFfrT6oEgL351CHQm0NvbdiKb6uj_Bc6NTmoTR0fX5VONihzCQI-Jonmiz1OzIn7TOj941-RH7ySeNmTTTCFfR4IKew-H1Ado&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
          &lt;img alt=&quot;NetAnim IP/MAC Table&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhj3bsfRcnPqHbjNXw8iHTvGi5Yw5FoA3Rj03evWJ4HhGt2oZdis8OzaHwlnoGy_heCuwEe-Gvdo3yYaxe7Gv--xbSdTzyFfrT6oEgL351CHQm0NvbdiKb6uj_Bc6NTmoTR0fX5VONihzCQI-Jonmiz1OzIn7TOj941-RH7ySeNmTTTCFfR4IKew-H1Ado=w640-h416&quot; style=&quot;max-width: 100%; height: auto;&quot; title=&quot;netanim&quot; width=&quot;640&quot; /&gt;
        &lt;/a&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;em&gt;Fig. 2: NetAnim Stats tab — IP-MAC mapping for all 4 nodes confirming correct address assignment. Node 1 (Router) shows 3 interfaces connecting to server and both clients.&lt;/em&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;8. Wireshark Packet Analysis&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The pcap file (&lt;code&gt;vod_capture-0-0.pcap&lt;/code&gt;) was captured on the backbone link and opened in Wireshark. It confirms the TCP three-way handshake (SYN at frame 1, port 49153 &amp;rarr; 9), followed by sustained bulk data transfer. Frames labelled &quot;DISCARD&quot; (1502 bytes = 1448 B payload + headers) represent the continuous video stream. The total capture has 23,940 packets over 20 seconds, confirming heavy sustained data flow.
&lt;/p&gt;

&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center;&quot;&gt;
        &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgakCqvWzpAuXLymHrg_DUbxLv4OySx12qkdXguzVgH6nPfJcsO1YkUrBazfqPEHPgDQbWT6cYdWzMF1g1Sk5chI8n2hXM6qF4ywLFJVhjC8Uyff5Ub9Zo_81diIUzeQtPKPbhTmV3qE4Rf30CG_1VOdgVpal_RJRd5bdUzX77Uoxhf1Jcnyvz1a0y3dNA&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;
          &lt;img alt=&quot;Wireshark Trace&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgakCqvWzpAuXLymHrg_DUbxLv4OySx12qkdXguzVgH6nPfJcsO1YkUrBazfqPEHPgDQbWT6cYdWzMF1g1Sk5chI8n2hXM6qF4ywLFJVhjC8Uyff5Ub9Zo_81diIUzeQtPKPbhTmV3qE4Rf30CG_1VOdgVpal_RJRd5bdUzX77Uoxhf1Jcnyvz1a0y3dNA=w640-h416&quot; style=&quot;max-width: 100%; height: auto;&quot; title=&quot;wireshark&quot; width=&quot;640&quot; /&gt;
        &lt;/a&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;em&gt;Fig. 3: Wireshark capture (vod_capture-0-0.pcap) — 23,940 packets total. Frame 1 shows TCP SYN (port 49153 &amp;rarr; 9). Frames 5+ show 1502-byte data segments from Server (10.1.1.1) to Client 0 (10.1.2.2).&lt;/em&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;9. Performance Graph — Throughput vs Time&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The graph below was generated using Gnuplot from &lt;code&gt;vod_throughput_flow1.dat&lt;/code&gt; and &lt;code&gt;vod_throughput_flow2.dat&lt;/code&gt;. The x-axis shows simulation time (0–20s), and the y-axis shows TCP throughput (Mbps).
&lt;/p&gt;

&lt;div style=&quot;clear: both; text-align: center;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhsu_cn1HkG5_j0I_ZXLmc8V0CzJKz8u44fO6E7IyymTV1BRXjoVBdWUXqwwLXcoGWikwD5l3hYaiTZGVvC1unCcyUo4qpZqV-gz7cu4BCjgpX_5dE9jInPMlTs8XY8l-qOvFod82SEnsfQXNbWU5hpC4YIZBkjUpO7bMjdFfsSG0JFmSWg25cLjsjjsFI&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;TCP Throughput Graph&quot; height=&quot;356&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhsu_cn1HkG5_j0I_ZXLmc8V0CzJKz8u44fO6E7IyymTV1BRXjoVBdWUXqwwLXcoGWikwD5l3hYaiTZGVvC1unCcyUo4qpZqV-gz7cu4BCjgpX_5dE9jInPMlTs8XY8l-qOvFod82SEnsfQXNbWU5hpC4YIZBkjUpO7bMjdFfsSG0JFmSWg25cLjsjjsFI=w640-h356&quot; style=&quot;max-width: 100%; height: auto;&quot; title=&quot;TCP&quot; width=&quot;640&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;em&gt;Fig. 4: TCP Throughput (Mbps) vs Time (s) — Flow 1 (Client 0, pink) and Flow 2 (Client 1, teal). Both flows start at ~4.75 Mbps after TCP slow-start (t=1.5s), then stabilise near 4.992 Mbps, saturating the 5 Mbps access link. A dip to ~4.65 Mbps at t=10.5s indicates a TCP NewReno retransmission event. Both flows recover quickly, demonstrating TCP fairness.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;10. Flow Monitor Results&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The FlowMonitor captured 4 flows — 2 downstream video streams (Flows 1 &amp;amp; 2: Server &amp;rarr; Clients) and 2 upstream TCP ACK flows (Flows 3 &amp;amp; 4: Clients &amp;rarr; Server). Key metrics are summarised below:
&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;8&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 100%; text-align: left; font-family: &#39;Times New Roman&#39;, serif;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #1F3864; color: white;&quot;&gt;
      &lt;th&gt;Flow ID&lt;/th&gt;
      &lt;th&gt;Source &amp;rarr; Destination&lt;/th&gt;
      &lt;th&gt;Throughput&lt;/th&gt;
      &lt;th&gt;Mean Delay&lt;/th&gt;
      &lt;th&gt;Mean Jitter&lt;/th&gt;
      &lt;th&gt;Loss %&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr style=&quot;background-color: #ffffff;&quot;&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;10.1.1.1 &amp;rarr; 10.1.2.2&lt;/td&gt;
      &lt;td&gt;4.979 Mbps&lt;/td&gt;
      &lt;td&gt;113.909 ms&lt;/td&gt;
      &lt;td&gt;2.387 ms&lt;/td&gt;
      &lt;td&gt;0.905 %&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #DCE6F1;&quot;&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;10.1.1.1 &amp;rarr; 10.1.3.2&lt;/td&gt;
      &lt;td&gt;4.984 Mbps&lt;/td&gt;
      &lt;td&gt;112.952 ms&lt;/td&gt;
      &lt;td&gt;2.389 ms&lt;/td&gt;
      &lt;td&gt;0.916 %&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #ffffff;&quot;&gt;
      &lt;td&gt;3 (ACK)&lt;/td&gt;
      &lt;td&gt;10.1.2.2 &amp;rarr; 10.1.1.1&lt;/td&gt;
      &lt;td&gt;0.091 Mbps&lt;/td&gt;
      &lt;td&gt;7.132 ms&lt;/td&gt;
      &lt;td&gt;0.000 ms&lt;/td&gt;
      &lt;td&gt;0.049 %&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #DCE6F1;&quot;&gt;
      &lt;td&gt;4 (ACK)&lt;/td&gt;
      &lt;td&gt;10.1.3.2 &amp;rarr; 10.1.1.1&lt;/td&gt;
      &lt;td&gt;0.091 Mbps&lt;/td&gt;
      &lt;td&gt;7.134 ms&lt;/td&gt;
      &lt;td&gt;0.000 ms&lt;/td&gt;
      &lt;td&gt;0.025 %&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;em&gt;Table 1: FlowMonitor statistics. Flows 1 &amp;amp; 2 = VoD video streams. Flows 3 &amp;amp; 4 = TCP ACK returns (low throughput by design). All values from vod_flowmon.xml.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;11. Trace File Analysis (&lt;code&gt;vod_trace.tr&lt;/code&gt;)&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The ASCII trace file records every enqueue (+), dequeue (-), and receive (r) event. Key observations:
&lt;/p&gt;
&lt;ul style=&quot;line-height: 1.6;&quot;&gt;
  &lt;li&gt;&lt;strong&gt;t=1.000s:&lt;/strong&gt; Server enqueues TCP SYN to Client 0 (port 49153 &amp;rarr; 9) and Client 1 (port 49154 &amp;rarr; 10) simultaneously.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;t=1.002s:&lt;/strong&gt; Router (Node 1) receives and forwards SYN packets to respective client access links.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;t=1.007s:&lt;/strong&gt; Client 0 (Node 2) receives SYN, replies with SYN-ACK. Client 1 (Node 3) similarly responds.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;t=1.014s:&lt;/strong&gt; Server completes 3-way handshake, immediately enqueues 10 data segments (1448 bytes each) — TCP slow-start begins with cwnd = 10 MSS.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;t=1.015s onwards:&lt;/strong&gt; Bulk data segments flow at 10 Mbps backbone rate through router to both clients continuously.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;table border=&quot;1&quot; cellpadding=&quot;8&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 100%; text-align: left; font-family: &#39;Times New Roman&#39;, serif;&quot;&gt;
  &lt;thead&gt;
    &lt;tr style=&quot;background-color: #1F3864; color: white;&quot;&gt;
      &lt;th&gt;Metric&lt;/th&gt;
      &lt;th&gt;Flow 1 (&amp;rarr; Client 0)&lt;/th&gt;
      &lt;th&gt;Flow 2 (&amp;rarr; Client 1)&lt;/th&gt;
      &lt;th&gt;Notes&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr style=&quot;background-color: #ffffff;&quot;&gt;
      &lt;td&gt;&lt;strong&gt;Tx Packets&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;7,956&lt;/td&gt;
      &lt;td&gt;7,966&lt;/td&gt;
      &lt;td&gt;Near equal — fair sharing&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #DCE6F1;&quot;&gt;
      &lt;td&gt;&lt;strong&gt;Rx Packets&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;7,884&lt;/td&gt;
      &lt;td&gt;7,893&lt;/td&gt;
      &lt;td&gt;Less than 1% loss&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #ffffff;&quot;&gt;
      &lt;td&gt;&lt;strong&gt;Lost Packets&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;72&lt;/td&gt;
      &lt;td&gt;73&lt;/td&gt;
      &lt;td&gt;Tail-drop at router queue&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #DCE6F1;&quot;&gt;
      &lt;td&gt;&lt;strong&gt;Min Delay&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;7.13 ms&lt;/td&gt;
      &lt;td&gt;7.19 ms&lt;/td&gt;
      &lt;td&gt;Propagation delay only (2 ms + 5 ms)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #ffffff;&quot;&gt;
      &lt;td&gt;&lt;strong&gt;Max Delay&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;259.6 ms&lt;/td&gt;
      &lt;td&gt;252.4 ms&lt;/td&gt;
      &lt;td&gt;Queue buildup at peak load&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr style=&quot;background-color: #DCE6F1;&quot;&gt;
      &lt;td&gt;&lt;strong&gt;Rx Bytes&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;11,823,108 B&lt;/td&gt;
      &lt;td&gt;11,836,608 B&lt;/td&gt;
      &lt;td&gt;~11.3 MB received each&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;
  &lt;em&gt;Table 2: Per-flow packet statistics extracted from vod_flowmon.xml. Min delay = ~7 ms (2 ms backbone + 5 ms access). Max delay shows router queue buildup during peak congestion.&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;12. Result Analysis&lt;/h2&gt;

&lt;h3&gt;12.1 Throughput Analysis&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Both Flow 1 and Flow 2 achieve approximately 4.979 Mbps and 4.984 Mbps respectively, very close to the 5 Mbps access link capacity. This confirms that the bottleneck is the 5 Mbps access link, not the 10 Mbps backbone. TCP NewReno successfully discovers and utilises nearly all available bandwidth. The tiny difference of 0.005 Mbps between the two flows demonstrates near-perfect TCP fairness — a hallmark of TCP&#39;s AIMD (Additive Increase Multiplicative Decrease) algorithm when two flows share the same bottleneck link.
&lt;/p&gt;

&lt;h3&gt;12.2 Delay Analysis&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  The mean end-to-end delay of approximately 113 ms is significantly higher than the minimum propagation delay of 7 ms (2 ms backbone + 5 ms access). This queuing delay is caused by the router&#39;s DropTail queue filling up as the server transmits at 10 Mbps while each access link drains at only 5 Mbps. Maximum delay of 259 ms corresponds to maximum queue occupancy. This bufferbloat effect is a known issue in VoD systems and would require AQM (Active Queue Management) such as CoDel or RED to mitigate in production networks.
&lt;/p&gt;

&lt;h3&gt;12.3 Jitter Analysis&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Mean jitter of approximately 2.387–2.389 ms is acceptably low for wired VoD streaming. Jitter arises from variable queuing delays as packets compete at the router queue. In real VoD systems, a client-side playback buffer of 2–5 seconds absorbs this jitter. For live or interactive video, jitter below 30 ms is required — this simulation comfortably meets that standard.
&lt;/p&gt;

&lt;h3&gt;12.4 Packet Loss Analysis&lt;/h3&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  Flows 1 and 2 each experience approximately 72–73 lost packets out of 7,900+ transmitted (loss ~0.905% and ~0.916%). Losses occur due to DropTail queue overflow at the router when both flows burst simultaneously. TCP NewReno detects losses via duplicate ACKs, halves the congestion window (multiplicative decrease), and retransmits — visible as the throughput dip at t=10.5s in the graph. The ACK return flows (3 and 4) show near-zero loss, confirming the upstream path is uncongested.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2&gt;13. Conclusion&lt;/h2&gt;
&lt;p style=&quot;text-align: justify; line-height: 1.6;&quot;&gt;
  This exercise successfully demonstrated the simulation of a client-server Video-on-Demand system using NS-3 with TCP Socket Factory and Flow Monitor. TCP NewReno effectively utilised available bandwidth, achieving approximately 4.98 Mbps per client on a 5 Mbps access link, while maintaining near-perfect fairness between the two simultaneous streams. The FlowMonitor provided comprehensive per-flow metrics confirming system performance. The 113 ms mean delay revealed bufferbloat at the router queue, a key real-world network engineering consideration. NetAnim visually confirmed correct packet routing. Wireshark verified TCP handshake, segment sizes, and sustained bulk transfer behaviour. The tools and techniques used — NS-3, FlowMonitor, NetAnim, Wireshark, Gnuplot, and ASCII trace analysis — are directly applicable to real-world multimedia network design and performance evaluation.
&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/6759036038119768296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/08/simulation-of-client-server-video-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/6759036038119768296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/6759036038119768296'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/08/simulation-of-client-server-video-on.html' title='Simulation of a Client Server Video-on-Demand (VoD) System Using TCP Socket Factory | NS3 Project 21'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjLJfVAR9WAsl3jPeV2LVJ4AUJz7RDfKWmAQIlZUioaKqckGzDYRIiWQmy9sOBXrxA174-yKZfT1Gd7lMPwXnDQPvcP_EW_cdxmlxWCEWk3l1ELX6ksMByfn0InPdLUpHI720UJOSE08MoC-wskzjtOkQVXfNK3Bi8-i8zg2EzF0QCmhl-LIVMAwe_wjJU=s72-w640-h416-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-4225876636880287988</id><published>2026-07-23T08:43:00.000+05:30</published><updated>2026-09-09T08:20:15.243+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Simulation and Analysis of TCP Three-Way Handshake using ns-3 | NS3 Project 20</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulation and Analysis of TCP Three-Way Handshake using ns-3&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;Question&lt;/h2&gt;
&lt;p&gt;
  Generate and analyze Wireshark traces for TCP three-way handshake and data transfer.&lt;br /&gt;&lt;br /&gt;
  &lt;strong&gt;LLM Used:&lt;/strong&gt; ChatGPT
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Create a simple point-to-point network topology with 2 nodes (client and server).&lt;/li&gt;
  &lt;li&gt;Use TCP protocol with &lt;code&gt;BulkSendApplication&lt;/code&gt; on the client and &lt;code&gt;PacketSink&lt;/code&gt; on the server.&lt;/li&gt;
  &lt;li&gt;Configure link parameters such as &lt;code&gt;DataRate&lt;/code&gt; and &lt;code&gt;Delay&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Enable PCAP tracing so that the output can be opened in Wireshark to observe TCP three-way handshake (SYN, SYN-ACK, ACK) and data packets.&lt;/li&gt;
  &lt;li&gt;Enable FlowMonitor to measure performance metrics such as throughput, delay, and packet loss, and export results to a &lt;b&gt;tcp_output.flowmonitor&lt;/b&gt; file.&lt;/li&gt;
  &lt;li&gt;Enable NetAnim and generate an &lt;b&gt;XML file (tcp.xml)&lt;/b&gt; for animation visualization.&lt;/li&gt;
  &lt;li&gt;Ensure the program runs using the command: &lt;b&gt;&lt;code&gt;./ns3 run scratch/24bps1078.cc&lt;/code&gt;&lt;/b&gt;&lt;/li&gt;
  &lt;li&gt;Include necessary headers, namespaces, and complete working code without errors.&lt;/li&gt;
  &lt;li&gt;Add comments explaining each major section of the code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Additionally:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Use proper IP addressing and port configuration.&lt;/li&gt;
  &lt;li&gt;Set simulation time appropriately.&lt;/li&gt;
  &lt;li&gt;Ensure traffic is generated so that meaningful FlowMonitor data is produced.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Network Topology&lt;/h2&gt;
&lt;p&gt;
  The network consists of two nodes connected using a point-to-point link. Node 0 (10.1.1.1) acts as the client, while Node 1 (10.1.1.2) acts as the server. A TCP connection is established between the two nodes, where the client initiates communication and sends data to the server.
&lt;/p&gt;

&lt;pre style=&quot;background-color: #1e1e1e; color: #d4d4d4; border-left: 4px solid #007acc; padding: 14px; font-family: &#39;Courier New&#39;, Consolas, monospace; overflow-x: auto; border-radius: 6px;&quot;&gt;
                  10.1.1.0
       n0 -------------------------- n1
    (client)      point-to-point   (Server)
&lt;/pre&gt;

&lt;h2&gt;Source Code&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #75715e;&quot;&gt;// Simulation of TCP Three-Way Handshake and Data Transfer using ns-3&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Includes: FlowMonitor, NetAnim, and Wireshark (PCAP)&lt;/span&gt;

&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt; ()
{
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 1. Create Nodes (Client &amp;amp; Server)&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    NodeContainer nodes;
    nodes.Create(2);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 2. Configure Point-to-Point Link&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    NetDeviceContainer devices = p2p.Install(nodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 3. Install Internet Stack&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    InternetStackHelper stack;
    stack.Install(nodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 4. Assign IP Addresses&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    Ipv4AddressHelper address;
    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);

    Ipv4InterfaceContainer interfaces = address.Assign(devices);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Enable Routing&lt;/span&gt;
    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 5. Configure Applications&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    uint16_t port = 8080;

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Server (PacketSink)&lt;/span&gt;
    PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(Ipv4Address::GetAny(), port));

    ApplicationContainer serverApp = sink.Install(nodes.Get(1));
    serverApp.Start(Seconds(0.0));
    serverApp.Stop(Seconds(10.0));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Client (BulkSend)&lt;/span&gt;
    BulkSendHelper client(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(interfaces.GetAddress(1), port));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Limit data&lt;/span&gt;
    client.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxBytes&quot;&lt;/span&gt;, UintegerValue(1000000)); &lt;span style=&quot;color: #75715e;&quot;&gt;// 1MB&lt;/span&gt;

    ApplicationContainer clientApp = client.Install(nodes.Get(0));
    clientApp.Start(Seconds(1.0));  &lt;span style=&quot;color: #75715e;&quot;&gt;// Start after server&lt;/span&gt;
    clientApp.Stop(Seconds(10.0));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 6. Enable FlowMonitor&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    FlowMonitorHelper flowHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowHelper.InstallAll();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 7. Enable NetAnim (Animation)&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;tcp.xml&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 8. Enable PCAP (Wireshark)&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    p2p.EnablePcapAll(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;tcp_trace&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 9. Run Simulation&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    Simulator::Stop(Seconds(10.0));
    Simulator::Run();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 10. Save FlowMonitor Results&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    monitor-&amp;gt;CheckForLostPackets();
    flowHelper.SerializeToXmlFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;tcp_output.flowmonitor&quot;&lt;/span&gt;, true, true);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// 11. Cleanup&lt;/span&gt;
    &lt;span style=&quot;color: #75715e;&quot;&gt;// -----------------------------&lt;/span&gt;
    Simulator::Destroy();

    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Animation Using NetAnim&lt;/h2&gt;
&lt;p&gt;
  The animation shows packet transmission over the link, including the TCP three-way handshake followed by continuous data transfer. The arrows indicate the direction of packet flow between the client and server. This setup demonstrates reliable data communication using TCP in a simple network topology.
&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgd-ru5GAAAhaeoDSjmY-rzdCo0PI6gGJHa9Ehq2-3RR3NIrDLpwigue7TlNMe0mBu6g0wibZmp0i9CJgnKmzUAaRHlHFLcLY-kIkPwFHtXGUGuN8Ql-W6Mlf1eqHuSw8EB8Gl55iMiD_qOiGoBFPbZIfbJiKNb0pkIpr6O2b7bWfBnyqCIEfDqFVkULF0&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;NetAnim Simulation Output&quot; data-original-height=&quot;514&quot; data-original-width=&quot;1094&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgd-ru5GAAAhaeoDSjmY-rzdCo0PI6gGJHa9Ehq2-3RR3NIrDLpwigue7TlNMe0mBu6g0wibZmp0i9CJgnKmzUAaRHlHFLcLY-kIkPwFHtXGUGuN8Ql-W6Mlf1eqHuSw8EB8Gl55iMiD_qOiGoBFPbZIfbJiKNb0pkIpr6O2b7bWfBnyqCIEfDqFVkULF0&quot; width=&quot;320&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2&gt;FlowMonitor Data Analysis and Graph Plotting Using Gnuplot&lt;/h2&gt;
&lt;pre style=&quot;background-color: #1e1e1e; color: #4ec9b0; border-left: 4px solid #28a745; padding: 12px; font-family: &#39;Courier New&#39;, Consolas, monospace; overflow-x: auto; border-radius: 6px;&quot;&gt;&lt;code&gt;FlowID: 1 (TCP 10.1.1.1/49153 --&amp;gt; 10.1.1.2/8080)
        TX bitrate: 4959.98 kbit/s
        RX bitrate: 4960.01 kbit/s
        Mean Delay: 60.53 ms
        Packet Loss Ratio: 0.00 %

FlowID: 2 (TCP 10.1.1.2/8080 --&amp;gt; 10.1.1.1/49153)
        TX bitrate: 220.58 kbit/s
        RX bitrate: 220.57 kbit/s
        Mean Delay: 2.09 ms
        Packet Loss Ratio: 0.00 %&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
  The graph represents the throughput of two TCP flows observed during the simulation. Flow 1 corresponds to the primary data transfer from the client (10.1.1.1) to the server (10.1.1.2), showing a high throughput of approximately 4960 Kbps. Flow 2 represents acknowledgment packets transmitted from the server to the client, which have significantly lower throughput (~220 Kbps).
&lt;/p&gt;
&lt;p&gt;
  This behavior reflects the nature of TCP communication, where data transmission dominates in one direction while acknowledgments are sent in the reverse direction. The absence of packet loss and stable throughput indicates efficient and reliable communication.
&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjdaK02NAtABGnNjsm8NAVKoB9zESydeuteyD9_-lR_ka6PGIxGuUqE-K1gnE3lr8AiiZvubxNjBKvTzNIoOMKkpKDZjXpcHknHIyS5XaxOiQUj6NdR69KTkhFsoiHOuDfykfcT6eSfo4aqpeHhs53sRdcIAKdQBkBrW4nWm9pLvkfIblJptFfcJz6r8UM&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;Throughput Graph&quot; data-original-height=&quot;688&quot; data-original-width=&quot;918&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjdaK02NAtABGnNjsm8NAVKoB9zESydeuteyD9_-lR_ka6PGIxGuUqE-K1gnE3lr8AiiZvubxNjBKvTzNIoOMKkpKDZjXpcHknHIyS5XaxOiQUj6NdR69KTkhFsoiHOuDfykfcT6eSfo4aqpeHhs53sRdcIAKdQBkBrW4nWm9pLvkfIblJptFfcJz6r8UM=w640-h480&quot; width=&quot;640&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2&gt;Wireshark Analysis&lt;/h2&gt;
&lt;p&gt;
  The TCP connection establishment process was analyzed using Wireshark by examining the captured PCAP file.
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;SYN Packet:&lt;/b&gt; The client (10.1.1.1) initiates the connection by sending a SYN packet to the server (10.1.1.2), indicating the start of communication.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;SYN-ACK Packet:&lt;/b&gt; The server responds with a SYN-ACK packet, acknowledging the client’s request and sending its own synchronization request.&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;ACK Packet:&lt;/b&gt; The client sends an ACK packet to confirm the connection establishment. After this step, the TCP connection is successfully established.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
  Following the handshake, data packets (PSH, ACK) are exchanged between the client and server, demonstrating reliable data transfer. The first three lines show the TCP three-way handshake, and the remaining packets indicate data transfer after the connection is successfully established.
&lt;/p&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjNRneiscZAGvCPJ9El15YztdaZeDaCRBRNXkz_mGIZiBWTJPW9tG-ZL_RNR2p-xc5doRVO-VflUuEerg3L9VjaLNQ-0S5SOmA4ME3ddzR5xo2xHxgAuGGguEoSFAHxPh2mZdBsZ5JZ49ohIPi6CxM0PMSneEce-mQIbHCBO7Oz4ck2MdQKyh_NiEEUpME&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;Wireshark Trace Packets&quot; data-original-height=&quot;150&quot; data-original-width=&quot;1004&quot; height=&quot;96&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjNRneiscZAGvCPJ9El15YztdaZeDaCRBRNXkz_mGIZiBWTJPW9tG-ZL_RNR2p-xc5doRVO-VflUuEerg3L9VjaLNQ-0S5SOmA4ME3ddzR5xo2xHxgAuGGguEoSFAHxPh2mZdBsZ5JZ49ohIPi6CxM0PMSneEce-mQIbHCBO7Oz4ck2MdQKyh_NiEEUpME=w640-h96&quot; width=&quot;640&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark Packet Analysis Details&quot; height=&quot;502&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiS9-uNWzZl4F-RKoT4P1epFhTKBQkTCLShYenFMEYx_T-VQe4n1p6mk2_onT6tEqAkLYWRJRlnIp5bz9Wl-MJRrOhKxW4YVmQNEDCBR5MI3hhwDeQkW8qvJgqPV637dcntikPsVGBu2qEpHkARN_PjvZb3RPeILiAjQ2DNlY5ANvDnrNGIFEuDoQwjZWg=w640-h502&quot; width=&quot;640&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/4225876636880287988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/07/simulation-and-analysis-of-tcp-three.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/4225876636880287988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/4225876636880287988'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/07/simulation-and-analysis-of-tcp-three.html' title='Simulation and Analysis of TCP Three-Way Handshake using ns-3 | NS3 Project 20'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgd-ru5GAAAhaeoDSjmY-rzdCo0PI6gGJHa9Ehq2-3RR3NIrDLpwigue7TlNMe0mBu6g0wibZmp0i9CJgnKmzUAaRHlHFLcLY-kIkPwFHtXGUGuN8Ql-W6Mlf1eqHuSw8EB8Gl55iMiD_qOiGoBFPbZIfbJiKNb0pkIpr6O2b7bWfBnyqCIEfDqFVkULF0=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-3437921437699312433</id><published>2026-07-22T08:40:00.000+05:30</published><updated>2026-09-09T08:20:42.344+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Simulate a dumbbell topology (10 senders + 10 receivers) with bottleneck link and study queue drop | NS3 Project 19</title><content type='html'>&lt;h2 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: arial;&quot;&gt;Simulate a
dumbbell topology (10 senders + 10 receivers) with a bottleneck link and study the queue drop&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Objective&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;To
simulate a dumbbell network topology with 10 senders and 10 receivers connected
via two central routers, creating a bottleneck link. The objective is to analyse
network congestion and TCP traffic behaviour, and study packet drops resulting from
queue overflow at the bottleneck link.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Introduction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;A
dumbbell topology describes a network structure consisting of two clusters of
nodes connected by a single, shared link, resembling a dumbbell. This
architecture is widely used in network simulations to study congestion control
mechanisms. When multiple senders transmit data simultaneously across the
shared &#39;bottleneck&#39; link, the incoming aggregate bandwidth often exceeds the
link&#39;s capacity. As the bottleneck router&#39;s queue fills up, any excess packets
are dropped, demonstrating congestion and triggering TCP backoff algorithms.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Methodology&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;1.
Initialise the NS-3 simulator and parse command-line arguments.&lt;br /&gt;
2. Create 10 sender nodes, 10 receiver nodes, and 2 router nodes.&lt;br /&gt;
3. Configure high-speed Point-to-Point access links (100 Mbps, 1ms delay)
connecting senders to Router 1, and receivers to Router 2.&lt;br /&gt;
4. Establish a low-bandwidth bottleneck link (10 Mbps, 20ms delay) between
Router 1 and Router 2, strictly limiting its queue capacity to force packet
drops.&lt;br /&gt;
5. Install the Internet stack on all nodes and appropriately assign IP
addresses.&lt;br /&gt;
6. Populate global routing tables so that nodes can reach each other.&lt;br /&gt;
7. Install PacketSink applications on receivers and BulkSend (TCP) applications
on senders, staggering start times to simulate realistic traffic.&lt;br /&gt;
8. Integrate FlowMonitor for traffic analysis and NetAnim for XML animation
generation.&lt;br /&gt;
9. Execute the simulation for 10 seconds and serialize output files.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Explanation of the
Source Code&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;The code
defines a structure containing senders, receivers, and routers. We define two
types of links using PointToPointHelper: high-speed access links and a
restrictive bottleneck link with a strict DropTailQueue limit. We assign
distinct IPv4 subnets to every interface and leverage IPv4GlobalRoutingHelper
to automatically route packets. BulkSendHelper initiates long-lived TCP flows
from senders, while PacketSinkHelper catches them. NetAnim logs visual states,
and FlowMonitor tracks metrics like throughput and queue drops into an XML
output file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Prompt Used&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Generate
a complete NS-3 script in C++ simulating a dumbbell topology with 10 senders
and 10 receivers communicating over a bottleneck link via two routers. Include
NS-3 flow-monitor and NetAnim setups, restrict the bottleneck queue size to
induce network drops, and provide the methodology, objective, and a plotting
script to visualize the congestion output.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;LLM Used&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;ChatGPT
(Anti-Gravity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Full Source Code&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;#include
&quot;ns3/core-module.h&quot;&lt;br /&gt;
#include &quot;ns3/network-module.h&quot;&lt;br /&gt;
#include &quot;ns3/internet-module.h&quot;&lt;br /&gt;
#include &quot;ns3/point-to-point-module.h&quot;&lt;br /&gt;
#include &quot;ns3/applications-module.h&quot;&lt;br /&gt;
#include &quot;ns3/ipv4-global-routing-helper.h&quot;&lt;br /&gt;
#include &quot;ns3/flow-monitor-module.h&quot;&lt;br /&gt;
#include &quot;ns3/netanim-module.h&quot;&lt;br /&gt;
&lt;br /&gt;
using namespace ns3;&lt;br /&gt;
&lt;br /&gt;
NS_LOG_COMPONENT_DEFINE (&quot;DumbbellTopology&quot;);&lt;br /&gt;
&lt;br /&gt;
int main (int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; uint32_t nSenders = 10;&lt;br /&gt;
&amp;nbsp; uint32_t nReceivers = 10;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; CommandLine cmd;&lt;br /&gt;
&amp;nbsp; cmd.Parse (argc, argv);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Nodes&lt;br /&gt;
&amp;nbsp; NodeContainer senders;&lt;br /&gt;
&amp;nbsp; senders.Create (nSenders);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; NodeContainer receivers;&lt;br /&gt;
&amp;nbsp; receivers.Create (nReceivers);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; NodeContainer routers;&lt;br /&gt;
&amp;nbsp; routers.Create (2); // Two routers for
dumbbell&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Links&lt;br /&gt;
&amp;nbsp; PointToPointHelper p2pAccess;&lt;br /&gt;
&amp;nbsp; p2pAccess.SetDeviceAttribute
(&quot;DataRate&quot;, StringValue (&quot;100Mbps&quot;));&lt;br /&gt;
&amp;nbsp; p2pAccess.SetChannelAttribute
(&quot;Delay&quot;, StringValue (&quot;1ms&quot;));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; PointToPointHelper p2pBottleneck;&lt;br /&gt;
&amp;nbsp; p2pBottleneck.SetDeviceAttribute
(&quot;DataRate&quot;, StringValue (&quot;10Mbps&quot;));&lt;br /&gt;
&amp;nbsp; p2pBottleneck.SetChannelAttribute
(&quot;Delay&quot;, StringValue (&quot;20ms&quot;));&lt;br /&gt;
&amp;nbsp; // Queue limit to force drops&lt;br /&gt;
&amp;nbsp; p2pBottleneck.SetQueue
(&quot;ns3::DropTailQueue&quot;, &quot;MaxSize&quot;, StringValue
(&quot;50p&quot;)); &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Topology connections&lt;br /&gt;
&amp;nbsp; std::vector&amp;lt;NetDeviceContainer&amp;gt;
senderDevices;&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nSenders;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; senderDevices.push_back
(p2pAccess.Install (senders.Get (i), routers.Get (0)));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; NetDeviceContainer bottleneckDevices;&lt;br /&gt;
&amp;nbsp; bottleneckDevices =
p2pBottleneck.Install (routers.Get (0), routers.Get (1));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; std::vector&amp;lt;NetDeviceContainer&amp;gt;
receiverDevices;&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nReceivers;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; receiverDevices.push_back
(p2pAccess.Install (routers.Get (1), receivers.Get (i)));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Internet Stack&lt;br /&gt;
&amp;nbsp; InternetStackHelper stack;&lt;br /&gt;
&amp;nbsp; stack.Install (senders);&lt;br /&gt;
&amp;nbsp; stack.Install (receivers);&lt;br /&gt;
&amp;nbsp; stack.Install (routers);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // IP Assignments&lt;br /&gt;
&amp;nbsp; Ipv4AddressHelper address;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp;
std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; senderInterfaces;&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nSenders;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::ostringstream subnet;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subnet &amp;lt;&amp;lt; &quot;10.1.&quot;
&amp;lt;&amp;lt; i + 1 &amp;lt;&amp;lt; &quot;.0&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address.SetBase (subnet.str
().c_str (), &quot;255.255.255.0&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; senderInterfaces.push_back
(address.Assign (senderDevices[i]));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; address.SetBase (&quot;10.2.1.0&quot;,
&quot;255.255.255.0&quot;);&lt;br /&gt;
&amp;nbsp; Ipv4InterfaceContainer
bottleneckInterfaces = address.Assign (bottleneckDevices);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;
std::vector&amp;lt;Ipv4InterfaceContainer&amp;gt; receiverInterfaces;&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nReceivers;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::ostringstream subnet;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subnet &amp;lt;&amp;lt; &quot;10.3.&quot;
&amp;lt;&amp;lt; i + 1 &amp;lt;&amp;lt; &quot;.0&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address.SetBase (subnet.str
().c_str (), &quot;255.255.255.0&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; receiverInterfaces.push_back
(address.Assign (receiverDevices[i]));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Applications&lt;br /&gt;
&amp;nbsp; uint16_t port = 9;&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nReceivers;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PacketSinkHelper sink
(&quot;ns3::TcpSocketFactory&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
InetSocketAddress (Ipv4Address::GetAny (), port));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ApplicationContainer sinkApp =
sink.Install (receivers.Get (i));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sinkApp.Start (Seconds (0.0));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sinkApp.Stop (Seconds (10.0));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nSenders;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BulkSendHelper source
(&quot;ns3::TcpSocketFactory&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
InetSocketAddress (receiverInterfaces[i].GetAddress (1), port));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source.SetAttribute
(&quot;MaxBytes&quot;, UintegerValue (0));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ApplicationContainer sourceApp =
source.Install (senders.Get (i));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceApp.Start (Seconds (1.0 + i *
0.1)); // Stagger start times&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceApp.Stop (Seconds (10.0));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // Flow Monitor&lt;br /&gt;
&amp;nbsp; FlowMonitorHelper flowmon;&lt;br /&gt;
&amp;nbsp; Ptr&amp;lt;FlowMonitor&amp;gt; monitor =
flowmon.InstallAll ();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; // NetAnim&lt;br /&gt;
&amp;nbsp; AnimationInterface anim
(&quot;dumbbell-animation.xml&quot;);&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nSenders;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anim.SetConstantPosition
(senders.Get (i), 10.0, 10.0 + i * 5);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp; anim.SetConstantPosition (routers.Get
(0), 30.0, 30.0);&lt;br /&gt;
&amp;nbsp; anim.SetConstantPosition (routers.Get
(1), 60.0, 30.0);&lt;br /&gt;
&amp;nbsp; for (uint32_t i = 0; i &amp;lt; nReceivers;
++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anim.SetConstantPosition
(receivers.Get (i), 80.0, 10.0 + i * 5);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Simulator::Stop (Seconds (10.0));&lt;br /&gt;
&amp;nbsp; Simulator::Run ();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; monitor-&amp;gt;SerializeToXmlFile
(&quot;flowmon-results.xml&quot;, true, true);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Simulator::Destroy ();&lt;br /&gt;
&amp;nbsp; return 0;&lt;br /&gt;
}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;OUTPUTS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;The
following figures show the simulation animation and the corresponding
congestion graph.&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype
 id=&quot;_x0000_t75&quot; coordsize=&quot;21600,21600&quot; o:spt=&quot;75&quot; o:preferrelative=&quot;t&quot;
 path=&quot;m@4@5l@4@11@9@11@9@5xe&quot; filled=&quot;f&quot; stroked=&quot;f&quot;&gt;
 &lt;v:stroke joinstyle=&quot;miter&quot;/&gt;
 &lt;v:formulas&gt;
  &lt;v:f eqn=&quot;if lineDrawn pixelLineWidth 0&quot;/&gt;
  &lt;v:f eqn=&quot;sum @0 1 0&quot;/&gt;
  &lt;v:f eqn=&quot;sum 0 0 @1&quot;/&gt;
  &lt;v:f eqn=&quot;prod @2 1 2&quot;/&gt;
  &lt;v:f eqn=&quot;prod @3 21600 pixelWidth&quot;/&gt;
  &lt;v:f eqn=&quot;prod @3 21600 pixelHeight&quot;/&gt;
  &lt;v:f eqn=&quot;sum @0 0 1&quot;/&gt;
  &lt;v:f eqn=&quot;prod @6 1 2&quot;/&gt;
  &lt;v:f eqn=&quot;prod @7 21600 pixelWidth&quot;/&gt;
  &lt;v:f eqn=&quot;sum @8 21600 0&quot;/&gt;
  &lt;v:f eqn=&quot;prod @7 21600 pixelHeight&quot;/&gt;
  &lt;v:f eqn=&quot;sum @10 21600 0&quot;/&gt;
 &lt;/v:formulas&gt;
 &lt;v:path o:extrusionok=&quot;f&quot; gradientshapeok=&quot;t&quot; o:connecttype=&quot;rect&quot;/&gt;
 &lt;o:lock v:ext=&quot;edit&quot; aspectratio=&quot;t&quot;/&gt;
&lt;/v:shapetype&gt;&lt;v:shape id=&quot;Picture_x0020_1&quot; o:spid=&quot;_x0000_i1026&quot; type=&quot;#_x0000_t75&quot;
 style=&#39;width:6in;height:259.5pt;visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:/Users/PRADEE~1/AppData/Local/Temp/msohtmlclip1/01/clip_image001.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img height=&quot;346&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjZOVNMM1SFvrgg-J9M_1sTm_8vd9oHAhEuaswdyjk5OLQ9tz2CrZOWQPeooRA4R-c5wZmY-F1RxqlahkCQa7HKb0nxzRAMV1RF90fgEh3R6Lqvu60Up1yX4WkBPQflpsY3DI3AT44CSdxyTC7b6gbqKFZCf3uLtkKlRFavoc5pseyRieybf9dzGgweIQQ&quot; v:shapes=&quot;Picture_x0020_1&quot; width=&quot;576&quot; /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Figure 1: Dumbbell
Topology Animation Showing Packet Flow&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape
 id=&quot;Picture_x0020_2&quot; o:spid=&quot;_x0000_i1025&quot; type=&quot;#_x0000_t75&quot; style=&#39;width:6in;
 height:259.5pt;visibility:visible;mso-wrap-style:square&#39;&gt;
 &lt;v:imagedata src=&quot;file:///C:/Users/PRADEE~1/AppData/Local/Temp/msohtmlclip1/01/clip_image003.png&quot;
  o:title=&quot;&quot;/&gt;
&lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img height=&quot;346&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjSVeGC8d8XNBNJn-XHgPrYhl_-dLmytE7BWjQVoXHdWQOx42CwNrOKnbUQ47mVoAxkHRYUjYw4zydNknwMLKW3NZ01H0Lw1rimF8wep7xScq3M9H8WMBTcfWCDjTklqrnuiUspI4yBUmzIDb2yuw-BKRXJhfBRniPgz4jImlCei5L9vGgMM7sg8wW7YsI&quot; v:shapes=&quot;Picture_x0020_2&quot; width=&quot;576&quot; /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;Figure 2: Graph
Showing Packet Drop / Throughput Behavior Under Congestion&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Explanation of Graph&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;The
packet drops occur directly due to the strict buffer limitation (50 packets)
configured at the bottleneck DropTail queue. Because the dumbbell topology
channels ten high-speed (100 Mbps) connections into a single constrained
bottleneck link (10 Mbps), the aggregate incoming bandwidth severely exceeds
what the hardware can process. This extreme disparity forces the central router
to hold packets in its queue until fully saturated. Upon reaching this
threshold, the bottleneck link immediately discards any excess arriving
packets, triggering simultaneous loss events per connection. The observed trend
across the graph illustrates high-volume random drops varying per flow,
confirming the chaotic nature of congestion and resulting TCP window backoffs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Execution Command&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;./ns3
run scratch/23bps1xxx.cc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Explanation&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;- This
command runs the NS-3 simulation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;- It
generates animation and flow monitoring output files.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;Screenshot Procedure&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;- Open
NetAnim using the generated XML file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: times;&quot;&gt;- Capture
animation screenshot.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: times;&quot;&gt;- Capture
graph screenshot.&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/3437921437699312433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/07/simulate-dumbbell-topology-10-senders.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/3437921437699312433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/3437921437699312433'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/07/simulate-dumbbell-topology-10-senders.html' title='Simulate a dumbbell topology (10 senders + 10 receivers) with bottleneck link and study queue drop | NS3 Project 19'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjZOVNMM1SFvrgg-J9M_1sTm_8vd9oHAhEuaswdyjk5OLQ9tz2CrZOWQPeooRA4R-c5wZmY-F1RxqlahkCQa7HKb0nxzRAMV1RF90fgEh3R6Lqvu60Up1yX4WkBPQflpsY3DI3AT44CSdxyTC7b6gbqKFZCf3uLtkKlRFavoc5pseyRieybf9dzGgweIQQ=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-937252794346570116</id><published>2026-07-21T08:33:00.000+05:30</published><updated>2026-09-09T08:22:31.451+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Effect of Frame Size on Collision Probability and Throughput in a CSMA-Based LAN Using ns-3 Simulation | NS3 Project 18</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Effect of Frame Size on Collision Probability and Throughput in a CSMA-Based LAN Using ns-3 Simulation&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;Aim:&lt;/h2&gt;
&lt;p&gt;
  To study the effect of frame size on collision probability in a CSMA-based LAN by varying frame sizes and observing the corresponding contention behavior and throughput using ns-3 simulation.
&lt;/p&gt;

&lt;h2&gt;LLM Used and Prompt&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LLM Used:&lt;/strong&gt; ChatGPT (GPT-5.4 Thinking)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prompt Used:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #ccc; margin: 1em 0; padding: 10px 16px; font-style: italic;&quot;&gt;
  Write an ns-3 C++ program runnable using &lt;code&gt;./ns3 run scratch/24BPS1151.cc&lt;/code&gt; to study the effect of frame size on collision probability in a CSMA-based LAN. Use multiple sender nodes connected via a CSMA channel to a receiver node. Vary frame sizes, estimate collision probability using a contention-based proxy, compute throughput, generate output files for plotting graphs, and include NetAnim support.
&lt;/blockquote&gt;

&lt;h2&gt;Topology Description&lt;/h2&gt;
&lt;p&gt;The network consists of a &lt;b&gt;shared CSMA LAN topology&lt;/b&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;6 Sender Nodes&lt;/b&gt;&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;1 Receiver Node&lt;/b&gt;&lt;/li&gt;
  &lt;li&gt;All nodes are connected using a &lt;b&gt;single CSMA bus (shared medium)&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Channel Type:&lt;/b&gt; CSMA (shared broadcast medium)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Data Rate:&lt;/b&gt; 10 Mbps&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Channel Delay:&lt;/b&gt; 5 microseconds&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Transport Protocol:&lt;/b&gt; UDP&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Traffic Type:&lt;/b&gt; Random (Poisson-like arrivals using exponential distribution)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Behavior:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;All sender nodes transmit data packets to a single receiver node.&lt;/li&gt;
  &lt;li&gt;Since the channel is shared, multiple nodes may attempt transmission simultaneously, leading to contention.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Source Code:&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/csma-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/mobility-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;iomanip&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #a6e22e;&quot;&gt;NS_LOG_COMPONENT_DEFINE&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;FrameSizeCollisionStudy&quot;&lt;/span&gt;);

&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Global statistics class&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;StudyStats&lt;/span&gt;
{
&lt;span style=&quot;color: #66d9ef;&quot;&gt;public:&lt;/span&gt;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;Configure&lt;/span&gt;(uint32_t frameSize, DataRate rate, Time channelDelay)
  {
    m_frameSize = frameSize;
    m_rate = rate;
    m_channelDelay = channelDelay;
    m_attempts = 0;
    m_collisionProxyCount = 0;
    m_busyUntil = Seconds(0);
  }

  &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;RecordAttempt&lt;/span&gt;()
  {
    Time now = Simulator::Now();
    m_attempts++;

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Approximate on-medium transmission time&lt;/span&gt;
    uint32_t effectiveBytes = m_frameSize + 38; &lt;span style=&quot;color: #75715e;&quot;&gt;// rough overhead&lt;/span&gt;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; txSeconds = (effectiveBytes * 8.0) / m_rate.GetBitRate();
    Time txTime = Seconds(txSeconds);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Proxy: if a send attempt happens while medium is already busy&lt;/span&gt;
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (now &amp;lt; m_busyUntil)
    {
      m_collisionProxyCount++;
    }

    Time start = (now &amp;gt; m_busyUntil) ? now : m_busyUntil;
    m_busyUntil = start + txTime + m_channelDelay;
  }

  uint64_t &lt;span style=&quot;color: #a6e22e;&quot;&gt;GetAttempts&lt;/span&gt;() &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt;
  {
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; m_attempts;
  }

  uint64_t &lt;span style=&quot;color: #a6e22e;&quot;&gt;GetCollisionProxyCount&lt;/span&gt;() &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt;
  {
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; m_collisionProxyCount;
  }

  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;GetCollisionProxyProbability&lt;/span&gt;() &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt;
  {
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (m_attempts == 0)
    {
      &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0.0;
    }
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(m_collisionProxyCount) / &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(m_attempts);
  }

&lt;span style=&quot;color: #66d9ef;&quot;&gt;private:&lt;/span&gt;
  uint32_t m_frameSize = 0;
  DataRate m_rate = DataRate(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;);
  Time m_channelDelay = MicroSeconds(5);
  uint64_t m_attempts = 0;
  uint64_t m_collisionProxyCount = 0;
  Time m_busyUntil = Seconds(0);
};

&lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; StudyStats g_stats;

&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Custom traffic application&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;TrafficApp&lt;/span&gt; : &lt;span style=&quot;color: #66d9ef;&quot;&gt;public&lt;/span&gt; Application
{
&lt;span style=&quot;color: #66d9ef;&quot;&gt;public:&lt;/span&gt;
  TrafficApp() = &lt;span style=&quot;color: #66d9ef;&quot;&gt;default&lt;/span&gt;;

  &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;Setup&lt;/span&gt;(Ptr&amp;lt;Socket&amp;gt; socket,
             Address peer,
             uint32_t packetSize,
             uint32_t maxPackets,
             &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; lambda)
  {
    m_socket = socket;
    m_peer = peer;
    m_packetSize = packetSize;
    m_maxPackets = maxPackets;
    m_lambda = lambda;
  }

&lt;span style=&quot;color: #66d9ef;&quot;&gt;private:&lt;/span&gt;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;virtual void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;StartApplication&lt;/span&gt;() &lt;span style=&quot;color: #66d9ef;&quot;&gt;override&lt;/span&gt;
  {
    m_running = &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;
    m_packetsSent = 0;

    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (!m_socket)
    {
      &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt;;
    }

    m_socket-&amp;gt;Bind();
    m_socket-&amp;gt;Connect(m_peer);

    m_exp = CreateObject&amp;lt;ExponentialRandomVariable&amp;gt;();
    m_exp-&amp;gt;SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Mean&quot;&lt;/span&gt;, DoubleValue(1.0 / m_lambda));

    Ptr&amp;lt;UniformRandomVariable&amp;gt; uv = CreateObject&amp;lt;UniformRandomVariable&amp;gt;();
    Time startOffset = Seconds(uv-&amp;gt;GetValue(0.001, 0.02));
    m_sendEvent = Simulator::Schedule(startOffset, &amp;amp;TrafficApp::SendPacket, &lt;span style=&quot;color: #66d9ef;&quot;&gt;this&lt;/span&gt;);
  }

  &lt;span style=&quot;color: #66d9ef;&quot;&gt;virtual void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;StopApplication&lt;/span&gt;() &lt;span style=&quot;color: #66d9ef;&quot;&gt;override&lt;/span&gt;
  {
    m_running = &lt;span style=&quot;color: #ae81ff;&quot;&gt;false&lt;/span&gt;;

    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (m_sendEvent.IsPending())
    {
      Simulator::Cancel(m_sendEvent);
    }

    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (m_socket)
    {
      m_socket-&amp;gt;Close();
    }
  }

  &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;SendPacket&lt;/span&gt;()
  {
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (!m_running || m_packetsSent &amp;gt;= m_maxPackets)
    {
      &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt;;
    }

    Ptr&amp;lt;Packet&amp;gt; packet = Create&amp;lt;Packet&amp;gt;(m_packetSize);
    g_stats.RecordAttempt();
    m_socket-&amp;gt;Send(packet);
    m_packetsSent++;

    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (m_packetsSent &amp;lt; m_maxPackets)
    {
      ScheduleNextTx();
    }
  }

  &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;ScheduleNextTx&lt;/span&gt;()
  {
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; nextGap = m_exp-&amp;gt;GetValue();
    m_sendEvent = Simulator::Schedule(Seconds(nextGap), &amp;amp;TrafficApp::SendPacket, &lt;span style=&quot;color: #66d9ef;&quot;&gt;this&lt;/span&gt;);
  }

  Ptr&amp;lt;Socket&amp;gt; m_socket;
  Address m_peer;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;bool&lt;/span&gt; m_running = &lt;span style=&quot;color: #ae81ff;&quot;&gt;false&lt;/span&gt;;
  uint32_t m_packetSize = 512;
  uint32_t m_maxPackets = 0;
  uint32_t m_packetsSent = 0;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; m_lambda = 100.0;
  EventId m_sendEvent;
  Ptr&amp;lt;ExponentialRandomVariable&amp;gt; m_exp;
};

&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Result structure&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;Result&lt;/span&gt;
{
  uint32_t frameSize;
  uint64_t attempts;
  uint64_t collisionProxyCount;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; collisionProxyProbability;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughputMbps;
  uint64_t rxBytes;
};

&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Run one case&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
Result &lt;span style=&quot;color: #a6e22e;&quot;&gt;RunOneCase&lt;/span&gt;(uint32_t frameSize,
                 &lt;span style=&quot;color: #66d9ef;&quot;&gt;bool&lt;/span&gt; createAnim,
                 uint32_t nSenders,
                 &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; offeredPpsPerSender,
                 &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; simTimeSec)
{
  NodeContainer nodes;
  nodes.Create(nSenders + 1); &lt;span style=&quot;color: #75715e;&quot;&gt;// last node = receiver&lt;/span&gt;

  &lt;span style=&quot;color: #75715e;&quot;&gt;// Attach a fixed mobility model for NetAnim&lt;/span&gt;
  MobilityHelper mobility;
  mobility.SetMobilityModel(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantPositionMobilityModel&quot;&lt;/span&gt;);
  mobility.Install(nodes);

  CsmaHelper csma;
  DataRate channelRate(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;);
  Time channelDelay = MicroSeconds(5);
  csma.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, DataRateValue(channelRate));
  csma.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, TimeValue(channelDelay));

  NetDeviceContainer devices = csma.Install(nodes);

  InternetStackHelper internet;
  internet.Install(nodes);

  Ipv4AddressHelper ipv4;
  ipv4.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
  Ipv4InterfaceContainer interfaces = ipv4.Assign(devices);

  uint16_t port = 9999;
  Address sinkAddress(InetSocketAddress(interfaces.GetAddress(nSenders), port));

  PacketSinkHelper sinkHelper(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                             InetSocketAddress(Ipv4Address::GetAny(), port));
  ApplicationContainer sinkApp = sinkHelper.Install(nodes.Get(nSenders));
  sinkApp.Start(Seconds(0.0));
  sinkApp.Stop(Seconds(simTimeSec));

  g_stats.Configure(frameSize, channelRate, channelDelay);

  &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; nSenders; ++i)
  {
    Ptr&amp;lt;Socket&amp;gt; socket = Socket::CreateSocket(nodes.Get(i), UdpSocketFactory::GetTypeId());
    Ptr&amp;lt;TrafficApp&amp;gt; app = CreateObject&amp;lt;TrafficApp&amp;gt;();
    app-&amp;gt;Setup(socket, sinkAddress, frameSize, 4000, offeredPpsPerSender);
    nodes.Get(i)-&amp;gtAddApplication(app);
    app-&amp;gt;SetStartTime(Seconds(0.5));
    app-&amp;gt;SetStopTime(Seconds(simTimeSec - 0.2));
  }

  AnimationInterface* anim = &lt;span style=&quot;color: #66d9ef;&quot;&gt;nullptr&lt;/span&gt;;
  &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (createAnim)
  {
    anim = &lt;span style=&quot;color: #66d9ef;&quot;&gt;new&lt;/span&gt; AnimationInterface(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;framesize-study-animation.xml&quot;&lt;/span&gt;, 50000);
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; nSenders; ++i)
    {
      anim-&amp;gt;SetConstantPosition(nodes.Get(i), 10 + i * 20, 20);
      anim-&amp;gt;UpdateNodeDescription(nodes.Get(i), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Sender-&quot;&lt;/span&gt; + std::to_string(i));
      anim-&amp;gt;UpdateNodeColor(nodes.Get(i), 255, 0, 0);
    }
    anim-&amp;gt;SetConstantPosition(nodes.Get(nSenders), 60, 80);
    anim-&amp;gt;UpdateNodeDescription(nodes.Get(nSenders), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Receiver&quot;&lt;/span&gt;);
    anim-&amp;gt;UpdateNodeColor(nodes.Get(nSenders), 0, 255, 0);
  }

  Simulator::Stop(Seconds(simTimeSec));
  Simulator::Run();

  Ptr&amp;lt;PacketSink&amp;gt; sink = DynamicCast&amp;lt;PacketSink&amp;gt;(sinkApp.Get(0));
  uint64_t rxBytes = sink-&amp;gt;GetTotalRx();
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughputMbps = (rxBytes * 8.0) / (simTimeSec * 1000000.0);

  Result r;
  r.frameSize = frameSize;
  r.attempts = g_stats.GetAttempts();
  r.collisionProxyCount = g_stats.GetCollisionProxyCount();
  r.collisionProxyProbability = g_stats.GetCollisionProxyProbability();
  r.throughputMbps = throughputMbps;
  r.rxBytes = rxBytes;

  Simulator::Destroy();

  &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (anim)
  {
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;delete&lt;/span&gt; anim;
  }

  &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; r;
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Write output files&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;WritePlotFiles&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; std::vector&amp;lt;Result&amp;gt;&amp;amp; results)
{
  std::ofstream dat(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;framesize-results.dat&quot;&lt;/span&gt;);
  dat &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;#FrameSize CollisionProxyProbability ThroughputMbps Attempts CollisionProxyCount RxBytes\n&quot;&lt;/span&gt;;
  &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;const auto&lt;/span&gt;&amp;amp; r : results)
  {
    dat &amp;lt;&amp;lt; r.frameSize &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; &quot;&lt;/span&gt;
        &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(6) &amp;lt;&amp;lt; r.collisionProxyProbability &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; &quot;&lt;/span&gt;
        &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(6) &amp;lt;&amp;lt; r.throughputMbps &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; &quot;&lt;/span&gt;
        &amp;lt;&amp;lt; r.attempts &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; &quot;&lt;/span&gt;
        &amp;lt;&amp;lt; r.collisionProxyCount &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; &quot;&lt;/span&gt;
        &amp;lt;&amp;lt; r.rxBytes &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
  }
  dat.close();

  std::ofstream plt1(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;collision-vs-framesize.plt&quot;&lt;/span&gt;);
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set terminal png size 1000,700\n&quot;&lt;/span&gt;;
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set output &#39;collision-vs-framesize.png&#39;\n&quot;&lt;/span&gt;;
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set title &#39;Frame Size vs Collision Proxy Probability in CSMA LAN&#39;\n&quot;&lt;/span&gt;;
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set xlabel &#39;Frame Size (bytes)&#39;\n&quot;&lt;/span&gt;;
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set ylabel &#39;Collision Proxy Probability&#39;\n&quot;&lt;/span&gt;;
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set grid\n&quot;&lt;/span&gt;;
  plt1 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;plot &#39;framesize-results.dat&#39; using 1:2 with linespoints lw 2 pt 7 title &#39;Collision Proxy&#39;\n&quot;&lt;/span&gt;;
  plt1.close();

  std::ofstream plt2(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;throughput-vs-framesize.plt&quot;&lt;/span&gt;);
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set terminal png size 1000,700\n&quot;&lt;/span&gt;;
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set output &#39;throughput-vs-framesize.png&#39;\n&quot;&lt;/span&gt;;
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set title &#39;Frame Size vs Throughput in CSMA LAN&#39;\n&quot;&lt;/span&gt;;
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set xlabel &#39;Frame Size (bytes)&#39;\n&quot;&lt;/span&gt;;
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set ylabel &#39;Throughput (Mbps)&#39;\n&quot;&lt;/span&gt;;
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;set grid\n&quot;&lt;/span&gt;;
  plt2 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;plot &#39;framesize-results.dat&#39; using 1:3 with linespoints lw 2 pt 7 title &#39;Throughput&#39;\n&quot;&lt;/span&gt;;
  plt2.close();
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// Main&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// ------------------------------------------------------------&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt;* argv[])
{
  uint32_t nSenders = 6;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; offeredPpsPerSender = 150.0;
  &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; simTimeSec = 10.0;

  CommandLine cmd(__FILE__);
  cmd.AddValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;nSenders&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Number of sender nodes&quot;&lt;/span&gt;, nSenders);
  cmd.AddValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;pps&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Offered packets/sec per sender&quot;&lt;/span&gt;, offeredPpsPerSender);
  cmd.AddValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;simTime&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Simulation time in seconds&quot;&lt;/span&gt;, simTimeSec);
  cmd.Parse(argc, argv);

  std::vector&amp;lt;uint32_t&amp;gt; frameSizes = {128, 256, 512, 1024, 1500};
  std::vector&amp;lt;Result&amp;gt; results;

  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n===== CSMA Frame Size Study =====\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Senders: &quot;&lt;/span&gt; &amp;lt;&amp;lt; nSenders
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;, Offered Load per Sender: &quot;&lt;/span&gt; &amp;lt;&amp;lt; offeredPpsPerSender
            &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; pps, Simulation Time: &quot;&lt;/span&gt; &amp;lt;&amp;lt; simTimeSec &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; s\n\n&quot;&lt;/span&gt;;

  &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; frameSizes.size(); ++i)
  {
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;bool&lt;/span&gt; createAnim = (frameSizes[i] == 512); &lt;span style=&quot;color: #75715e;&quot;&gt;// one representative animation case&lt;/span&gt;
    Result r = RunOneCase(frameSizes[i], createAnim, nSenders, offeredPpsPerSender, simTimeSec);
    results.push_back(r);

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;FrameSize=&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(4) &amp;lt;&amp;lt; r.frameSize
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; bytes | Attempts=&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(8) &amp;lt;&amp;lt; r.attempts
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; | BusyAttempts=&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(8) &amp;lt;&amp;lt; r.collisionProxyCount
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; | CollisionProxy=&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(6) &amp;lt;&amp;lt; r.collisionProxyProbability
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; | Throughput=&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(4) &amp;lt;&amp;lt; r.throughputMbps
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;;
  }

  WritePlotFiles(results);

  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\nOutput files generated:\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  framesize-results.dat\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  collision-vs-framesize.plt\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  throughput-vs-framesize.plt\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  framesize-study-animation.xml\n\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;To generate graphs using gnuplot:\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  gnuplot collision-vs-framesize.plt\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  gnuplot throughput-vs-framesize.plt\n\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;NOTE: ns-3 CSMA does not model true Ethernet collisions.\n&quot;&lt;/span&gt;;
  std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;The reported collision value is a contention-based proxy.\n&quot;&lt;/span&gt;;

  &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;CSMA Terminal Simulation Output&quot; height=&quot;253&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjDqOa1ZCNqhVArH-njKQ6xvTQz7-cqMwBOqXxOwcPbLMgROL6Ff0KfZF9UoaK4Y-uRw6bf4QQGBNHooVuB7QhgxreHRgMnA0ugFfQ9q0kat-2DCX0tReOp3sO4rXKhxWGaH1W3A10rlQymAZvDacatSiqF6moj45odjPpyntqo6_-ST5AyX-Oi0x-Ucoc&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;Animation Screenshots:&lt;/h2&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Screenshot 1&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj1VAJiJDk16kdjtSkTIa-Uml4Dn7T3zq659Alx9i113K9SkWhpusz7O3otj_Znqe1PEJojIhnG4gQee7DpT1NLU78JvdrIA_6wfWllAss6-AT8qi4Pw_2KVk5r8n4BmepFQhvUbJw_mwQMpk62Z3bRb2UqY44c_1ZyPM7MTG8PKZ5ftIpqcircP7rVB0g&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;NetAnim Screenshot 2&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgwOk7BfKsrjL6RNQp18TWNYSRabPACU7-uivmK3RQgdDnqDSU3i_8wrbceT6E0-m29xZ-P1Wdcm_M53eRv1W1Gc8tJWjPM01c4yOrzhei2pL2S2MjjvFzGo7Zp6B8-DU3i-IjJqXnkuWLvoMqzCtj3KDAJNOg7dSnYURe9pHwoGd0c2egPLm8pCxbwgSo&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;NetAnim Screenshot 3&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUT6JNhxvMekoFJNdlJVGMt10avsxfTZPLxgnY36hZZEuZskejx7I6SM0Ln_KjCW82tsDUwBmBPw52vPRRXRb4EWZIWFPNLY185nF0iTiS2c2uQcfS5hD3JsFYwk-l4-M6hfzqo9xh2O75L3wmQFmQtkwBvfYSL2BYau7fPl06T6BzMiImSAyOrjsJwOI&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;NetAnim Screenshot 4&quot; height=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgXMjlUhLAjpzO3SRFSidlvJ_gj423WaKB51GBBzbjx8H_jrQRJbAxXn5CFFO9KC3qlCGP2FkD-4_n0K_E9O5_6HGq7OzVI_qqkf5p3D6SZqriI-QQgLxjpU5wBMuUpH9jy-aeilaYQoPHFHIEn3eXBbQnMLIRUCw6jpaOmez9AQOJoOv7bX83hvUEfUoY&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The animation shows multiple sender nodes transmitting packets over a shared CSMA channel to a single receiver node. The shared medium leads to contention among nodes.
&lt;/p&gt;

&lt;h2&gt;Graph Screenshot(s)&lt;/h2&gt;

&lt;h3&gt;Graph 2: Frame Size vs Throughput&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Frame Size vs Throughput Graph&quot; height=&quot;460&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiPJYNJmJDeNdvewOxZNkrPLmLTI6LGh5_l9gpXlarJNycuUMoh51hFCp5wSYL0EKWquIj3Wt1kIxQ3ups5U3TddhN47iYC3hvElTiyISueOGJuQnl7-z-eQ-P4i3hL3YRe71ctGRKvkSYsy8WXbwr9JROv-SZS49U4h7XcCOrylET1RHbw8dgDun12ipU&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h4&gt;Throughput Graph Explanation&lt;/h4&gt;
&lt;p&gt;
  The throughput initially increases with frame size because larger frames carry more payload relative to overhead. However, as frame size continues to increase, the channel remains occupied for longer durations, increasing contention among nodes. This results in diminishing returns or slight degradation in throughput at higher frame sizes under heavy load conditions.
&lt;/p&gt;

&lt;h3&gt;Graph 1: Frame Size vs Collision Probability&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Frame Size vs Collision Proxy Probability Graph&quot; height=&quot;460&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiNpUihPWXPJf1Kp6EwawRxtHfogwt2EyhGFCP2cPZ-AlIJTALhll5ou0x-4KVFxT8HlmN7XvTAKkarA7wTfdkFI4W3iIrWZo4-ZiyFi_zqhAwKd1MbkBvlxtg9khGkMJZaL3To0Zge7Q59MV71rsyhVhWqqLOnr1rqNaai77h6YiYjE4UcPSovKHq61Jo&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h4&gt;Collision Probability Graph Explanation&lt;/h4&gt;
&lt;p&gt;
  The graph shows that collision probability increases with frame size. Larger frames occupy the shared medium for a longer duration, which increases the likelihood that other nodes attempt transmission while the channel is busy. This leads to higher contention levels. At higher frame sizes, the collision probability approaches saturation due to continuous channel occupancy under heavy traffic conditions.
&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;
  From the experiment, it is observed that frame size has a significant impact on collision behavior in a CSMA-based LAN. As frame size increases, the duration for which the channel remains occupied also increases, leading to higher chances of contention among nodes. This results in an increase in collision probability. While larger frames improve data efficiency by reducing overhead, excessive frame size can negatively affect network performance due to increased contention. Therefore, an optimal frame size must balance efficiency and collision probability.
&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/937252794346570116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/07/effect-of-frame-size-on-collision.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/937252794346570116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/937252794346570116'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/07/effect-of-frame-size-on-collision.html' title='Effect of Frame Size on Collision Probability and Throughput in a CSMA-Based LAN Using ns-3 Simulation | NS3 Project 18'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjDqOa1ZCNqhVArH-njKQ6xvTQz7-cqMwBOqXxOwcPbLMgROL6Ff0KfZF9UoaK4Y-uRw6bf4QQGBNHooVuB7QhgxreHRgMnA0ugFfQ9q0kat-2DCX0tReOp3sO4rXKhxWGaH1W3A10rlQymAZvDacatSiqF6moj45odjPpyntqo6_-ST5AyX-Oi0x-Ucoc=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-7689588972135577999</id><published>2026-07-20T09:00:00.000+05:30</published><updated>2026-09-09T08:23:48.412+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Performance Analysis of 50-Node Wireless Network Using NS3 | NS3 Project 17</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Performance Analysis of 50-Node Wireless Network Using NS-3&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;AIM:&lt;/h2&gt;
&lt;p&gt;
  To simulate a 50-node wireless network using the NS-3 network simulator and perform detailed performance analysis by evaluating key network metrics such as throughput, delay, packet delivery ratio (PDR), packet loss ratio (PLR), and bytes transmitted and received.
&lt;/p&gt;

&lt;h2&gt;PROMPT USED:&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LLM Used:&lt;/strong&gt; ChatGPT, Claude&lt;/p&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #ccc; margin: 1em 0; padding: 10px 16px; font-style: italic;&quot;&gt;
  Generate NS-3 code to simulate a 50-node wireless network using the AODV routing protocol and analyse network performance metrics such as throughput, delay, packet loss ratio, packet delivery ratio and bytes transmitted and received using FlowMonitor.
&lt;/blockquote&gt;

&lt;h2&gt;SOURCE CODE:&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/mobility-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/wifi-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/aodv-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #a6e22e;&quot;&gt;NS_LOG_COMPONENT_DEFINE&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ImprovedNetworkAudit&quot;&lt;/span&gt;);

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt; *argv[])
{
  uint32_t numNodes = 50;

  NodeContainer nodes;
  nodes.Create(numNodes);

  WifiHelper wifi;
  wifi.SetStandard(WIFI_STANDARD_80211b);

  YansWifiChannelHelper channel = YansWifiChannelHelper::Default();
  YansWifiPhyHelper phy;
  phy.SetChannel(channel.Create());

  WifiMacHelper mac;
  mac.SetType(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::AdhocWifiMac&quot;&lt;/span&gt;);

  NetDeviceContainer devices = wifi.Install(phy, mac, nodes);

  MobilityHelper mobility;
  mobility.SetPositionAllocator(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::GridPositionAllocator&quot;&lt;/span&gt;,
                                &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MinX&quot;&lt;/span&gt;, DoubleValue(0.0),
                                &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MinY&quot;&lt;/span&gt;, DoubleValue(0.0),
                                &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DeltaX&quot;&lt;/span&gt;, DoubleValue(20.0),
                                &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DeltaY&quot;&lt;/span&gt;, DoubleValue(20.0),
                                &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GridWidth&quot;&lt;/span&gt;, UintegerValue(10),
                                &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;LayoutType&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;RowFirst&quot;&lt;/span&gt;));

  mobility.SetMobilityModel(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantPositionMobilityModel&quot;&lt;/span&gt;);
  mobility.Install(nodes);

  AodvHelper aodv;
  InternetStackHelper internet;
  internet.SetRoutingHelper(aodv);
  internet.Install(nodes);

  Ipv4AddressHelper address;
  address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);

  Ipv4InterfaceContainer interfaces;
  interfaces = address.Assign(devices);

  &lt;span style=&quot;color: #75715e;&quot;&gt;/* ---------- MULTIPLE TRAFFIC FLOWS ---------- */&lt;/span&gt;
  uint16_t port = 9;
  &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; 10; i++)
  {
    uint32_t source = i;
    uint32_t destination = i + 10;

    OnOffHelper onoff(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                      Address(InetSocketAddress(interfaces.GetAddress(destination), port)));
    onoff.SetConstantRate(DataRate(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;1Mbps&quot;&lt;/span&gt;));

    ApplicationContainer app = onoff.Install(nodes.Get(source));
    app.Start(Seconds(1.0 + i));
    app.Stop(Seconds(20.0));

    PacketSinkHelper sink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                         Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
    ApplicationContainer sinkApp = sink.Install(nodes.Get(destination));
    sinkApp.Start(Seconds(0.0));
    sinkApp.Stop(Seconds(20.0));
  }

  &lt;span style=&quot;color: #75715e;&quot;&gt;/* ---------- FLOW MONITOR ---------- */&lt;/span&gt;
  FlowMonitorHelper flowmon;
  Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

  &lt;span style=&quot;color: #75715e;&quot;&gt;/* ---------- NETANIM ---------- */&lt;/span&gt;
  AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;network50.xml&quot;&lt;/span&gt;);
  anim.SetMaxPktsPerTraceFile(1000000);

  &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (uint32_t i = 0; i &amp;lt; nodes.GetN(); i++)
  {
    anim.UpdateNodeDescription(nodes.Get(i), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Node&quot;&lt;/span&gt; + std::to_string(i));
    anim.UpdateNodeColor(nodes.Get(i), 255, 0, 0);
  }

  &lt;span style=&quot;color: #75715e;&quot;&gt;/* ---------- SIMULATION ---------- */&lt;/span&gt;
  Simulator::Stop(Seconds(20));
  Simulator::Run();

  &lt;span style=&quot;color: #75715e;&quot;&gt;/* ---------- PERFORMANCE METRICS ---------- */&lt;/span&gt;
  monitor-&amp;gt;CheckForLostPackets();
  Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier = DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowmon.GetClassifier());
  std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats();

  &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; &amp;amp;flow : stats)
  {
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Flow ID: &quot;&lt;/span&gt; &amp;lt;&amp;lt; flow.first &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Tx Packets = &quot;&lt;/span&gt; &amp;lt;&amp;lt; flow.second.txPackets &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Rx Packets = &quot;&lt;/span&gt; &amp;lt;&amp;lt; flow.second.rxPackets &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Lost Packets = &quot;&lt;/span&gt; &amp;lt;&amp;lt; flow.second.lostPackets &amp;lt;&amp;lt; std::endl;

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughput = flow.second.rxBytes * 8.0 /
      (flow.second.timeLastRxPacket.GetSeconds() -
       flow.second.timeFirstTxPacket.GetSeconds()) / 1024;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Throughput: &quot;&lt;/span&gt; &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Kbps&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; delay = flow.second.delaySum.GetSeconds() / flow.second.rxPackets;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Average Delay: &quot;&lt;/span&gt; &amp;lt;&amp;lt; delay &amp;lt;&amp;lt; std::endl;

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; pdr = ((&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;)flow.second.rxPackets / flow.second.txPackets) * 100;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; plr = ((&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;)flow.second.lostPackets / flow.second.txPackets) * 100;

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packet Delivery Ratio: &quot;&lt;/span&gt; &amp;lt;&amp;lt; pdr &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;%&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Packet Loss Ratio: &quot;&lt;/span&gt; &amp;lt;&amp;lt; plr &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;%&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;
  }

  Simulator::Destroy();
  &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;TERMINAL OUTPUT:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal Output&quot; height=&quot;142&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjgRor7YWxwB1bWfM5qUtNWpDZBTUb1amEvnJIwItYmVopg8lx1pHuvpDItNt75PzPKpdK7BuhjZ_zM-YXKhRBqFW7m4QN5SvLn2zLD6FdCIFmp1tnM9wAW0aT3qLoUV2OQ4LKg9y9MykcuVasNgFoTY1OxdKNbbegncEVWpbd02VH-y3EKGe30p3vT6Yw&quot; width=&quot;299&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The above terminal output displays the performance statistics obtained from the NS-3 simulation using the FlowMonitor module. A total of 9277 packets were transmitted during the simulation, out of which 9276 packets were successfully received, resulting in only 1 packet loss.
&lt;/p&gt;
&lt;p&gt;
  The network achieved a throughput of approximately 2059.86 Kbps, indicating efficient data transmission between the nodes. The &lt;b&gt;average delay recorded was 0.000687 seconds&lt;/b&gt;, which shows that packets were delivered very quickly across the network.
&lt;/p&gt;
&lt;p&gt;
  The Packet Delivery Ratio (PDR) of 99.9892% indicates that almost all transmitted packets successfully reached the destination. Similarly, the Packet Loss Ratio (PLR) of 0.0107% is extremely low, demonstrating stable and reliable network communication.
&lt;/p&gt;
&lt;p&gt;
  Additionally, the simulation shows 5,009,580 bytes transmitted and 5,009,040 bytes received, confirming that the majority of the transmitted data was successfully delivered within the network. These results indicate that the simulated 50-node wireless network performs efficiently with minimal packet loss and low delay.
&lt;/p&gt;

&lt;h2&gt;NETWORK ANIMATION:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Network Topology Animation&quot; height=&quot;317&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgFiUNq59deLQcKayVJMpqFeMBMhLyOD-DfJXdWpaSGkNNl9kRZFNEdCJZTvEnTX3NTk6O9wDFY_1Py0KNFuke0play_rw78nOIUqVpm0B-nNgQa_EQkcPHVO0nwOsH-knkx-XC8ukP2SpysOGWkUYDYBOzWRtliV4gwnq1EbuTRC2MYJuSTbvwvF447M0&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The NetAnim tool is used to visualize the network topology generated by the NS-3 simulation. Each node represents a wireless device participating in network communication. The visualization helps understand the structure and connectivity of the simulated network.
&lt;/p&gt;

&lt;h2&gt;Throughput and Time graph:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh7SjH3cERoIzjpygICkNitkNMt9UxUcvSeoru4E4HfgESuDQYi0lWFk_aV8tXFdYHVp4gf-B5uRI-d3cBgnIUyKg-L2OyLhGr8N7FPY2MUzi9t9EH0B7mwnEoaMsBnueV1hfmDhU2EqXU7NQrHz82CI-oyRqwHraskmC9Q7fbq8vvLclIPGyxctYRHIhc&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;
    &lt;img alt=&quot;Throughput vs Time Graph&quot; data-original-height=&quot;476&quot; data-original-width=&quot;940&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh7SjH3cERoIzjpygICkNitkNMt9UxUcvSeoru4E4HfgESuDQYi0lWFk_aV8tXFdYHVp4gf-B5uRI-d3cBgnIUyKg-L2OyLhGr8N7FPY2MUzi9t9EH0B7mwnEoaMsBnueV1hfmDhU2EqXU7NQrHz82CI-oyRqwHraskmC9Q7fbq8vvLclIPGyxctYRHIhc=w640-h324&quot; width=&quot;640&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h3&gt;Graph Explanation:&lt;/h3&gt;
&lt;p&gt;
  The throughput graph was plotted using gnuplot based on the simulation results obtained from the NS-3 FlowMonitor output. The graph shows the throughput performance of the 50-node network during the simulation. The values show the increasing throughput trend during the simulation before stabilizing near the measured throughput value of ~2060 Kbps.
&lt;/p&gt;

&lt;h2&gt;RESULT ANALYSIS:&lt;/h2&gt;
&lt;p&gt;From the simulation output, the following results were observed:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Total Packets Transmitted:&lt;/b&gt; 9277&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Total Packets Received:&lt;/b&gt; 9276&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Packets Lost:&lt;/b&gt; 1&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Throughput:&lt;/b&gt; 2059.86 Kbps&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Average Delay:&lt;/b&gt; 0.000687 seconds&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Packet Delivery Ratio:&lt;/b&gt; 99.9892%&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Packet Loss Ratio:&lt;/b&gt; 0.0107%&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The high packet delivery ratio indicates efficient communication in the network while the packet loss ratio remains extremely low, demonstrating stable network behaviour.
&lt;/p&gt;

&lt;h2&gt;ADDITIONAL OBSERVATIONS:&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;An increasing number of nodes may increase network congestion.&lt;/li&gt;
  &lt;li&gt;Wireless channel interference can affect throughput.&lt;/li&gt;
  &lt;li&gt;Efficient routing protocols help reduce packet loss.&lt;/li&gt;
  &lt;li&gt;FlowMonitor helps analyse real-time network performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/7689588972135577999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/07/performance-analysis-of-50-node.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/7689588972135577999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/7689588972135577999'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/07/performance-analysis-of-50-node.html' title='Performance Analysis of 50-Node Wireless Network Using NS3 | NS3 Project 17'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjgRor7YWxwB1bWfM5qUtNWpDZBTUb1amEvnJIwItYmVopg8lx1pHuvpDItNt75PzPKpdK7BuhjZ_zM-YXKhRBqFW7m4QN5SvLn2zLD6FdCIFmp1tnM9wAW0aT3qLoUV2OQ4LKg9y9MykcuVasNgFoTY1OxdKNbbegncEVWpbd02VH-y3EKGe30p3vT6Yw=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-2027841118463321658</id><published>2026-07-16T15:09:25.474+05:30</published><updated>2026-09-09T08:24:39.990+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulation"/><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Simulation of Mixed TCP and UDP Traffic and Their Performance Impact Using ns3 | NS3 Project 16</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulation of Mixed TCP and UDP Traffic and their Performance Impact Using ns-3&lt;/b&gt;&lt;/h1&gt;

&lt;p&gt;
  The objective of this experiment is to simulate a network with both TCP and UDP traffic using ns-3 and analyze how they affect each other’s performance in terms of throughput. In computer networks, TCP (Transmission Control Protocol) is a reliable and congestion-controlled protocol, while UDP (User Datagram Protocol) is faster but does not implement congestion control. When both protocols share the same network, their behavior differs significantly. This experiment studies their interaction and performance impact.
&lt;/p&gt;

&lt;p&gt;
  A network topology with multiple nodes connected using point-to-point links is created in ns-3. TCP traffic is generated using &lt;code&gt;BulkSendApplication&lt;/code&gt; and UDP traffic is generated using &lt;code&gt;OnOffApplication&lt;/code&gt;. FlowMonitor is used to collect performance metrics such as throughput. NetAnim is used to visualize packet transmission.
&lt;/p&gt;

&lt;h2&gt;Source Code&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt; () {
    NodeContainer nodes;
    nodes.Create(4);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Point-to-Point links&lt;/span&gt;
    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    NetDeviceContainer d1 = p2p.Install(nodes.Get(0), nodes.Get(1));
    NetDeviceContainer d2 = p2p.Install(nodes.Get(1), nodes.Get(2));
    NetDeviceContainer d3 = p2p.Install(nodes.Get(2), nodes.Get(3));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Internet stack&lt;/span&gt;
    InternetStackHelper stack;
    stack.Install(nodes);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// IP addressing&lt;/span&gt;
    Ipv4AddressHelper address;

    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i1 = address.Assign(d1);

    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.2.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i2 = address.Assign(d2);

    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.3.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i3 = address.Assign(d3);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// ---------------- TCP TRAFFIC ----------------&lt;/span&gt;
    uint16_t tcpPort = 8080;

    BulkSendHelper tcpSource(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                             InetSocketAddress(i3.GetAddress(1), tcpPort));
    tcpSource.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxBytes&quot;&lt;/span&gt;, UintegerValue(0));

    ApplicationContainer tcpApp = tcpSource.Install(nodes.Get(0));
    tcpApp.Start(Seconds(1.0));
    tcpApp.Stop(Seconds(10.0));

    PacketSinkHelper tcpSink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                             InetSocketAddress(Ipv4Address::GetAny(), tcpPort));
    tcpSink.Install(nodes.Get(3));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// ---------------- UDP TRAFFIC ----------------&lt;/span&gt;
    uint16_t udpPort = 9090;

    OnOffHelper udpSource(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                          InetSocketAddress(i3.GetAddress(1), udpPort));
    udpSource.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;5Mbps&quot;&lt;/span&gt;));
    udpSource.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;PacketSize&quot;&lt;/span&gt;, UintegerValue(1024));

    ApplicationContainer udpApp = udpSource.Install(nodes.Get(1));
    udpApp.Start(Seconds(2.0));
    udpApp.Stop(Seconds(10.0));

    PacketSinkHelper udpSink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::UdpSocketFactory&quot;&lt;/span&gt;,
                             InetSocketAddress(Ipv4Address::GetAny(), udpPort));
    udpSink.Install(nodes.Get(3));

    &lt;span style=&quot;color: #75715e;&quot;&gt;// ---------------- FLOW MONITOR ----------------&lt;/span&gt;
    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// ---------------- NETANIM ----------------&lt;/span&gt;
    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;anim.xml&quot;&lt;/span&gt;);

    Simulator::Stop(Seconds(10.0));
    Simulator::Run();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Save results&lt;/span&gt;
    monitor-&amp;gt;SerializeToXmlFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;results.xml&quot;&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);

    Simulator::Destroy();
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Simulation Setup Details&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;LLM Used:&lt;/b&gt; ChatGPT (GPT-5.3)&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Prompt:&lt;/b&gt; “Generate ns-3 code to simulate mixed TCP and UDP traffic and analyze their performance using FlowMonitor.”&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Network Animation&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Simulation Animation&quot; height=&quot;303&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgI78rCb3yETO_X8pO3_UPi3uGRpvYSymEXv6v8q1Z0PDZ-yGYLdCGhbmZYOB3iG2dIiOE5jir2EYwZMHpBWG_Eh2ayrqfc5w3hYRqv-6VsvF3EIS9dDwdv7qsoLJm7_eRrso50fFBZipX7JkijFgl9YzgiMRI9eXz3k4QmPumb9ptdNmNzZMixW8Kq5MY&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The animation shows packet transmission between nodes. Both TCP and UDP flows are visible. UDP transmits continuously, while TCP adapts its rate. This demonstrates how both protocols share network resources.
&lt;/p&gt;

&lt;h2&gt;Throughput Analysis&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Throughput Comparison Graph&quot; height=&quot;529&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj412Wkpllx4JtImi7_tLG1iKoVmznXCXOEFMwPejAITeUKS0fFzn_TVSsy21p7lRO0FPa1njnAGlKHCSNI463XcDqaV58YAzNH3QKserUyUhLP_kiNRqulX-wHFu01XXrvpwqV_N40FYtbND51o8pNCxJJ7LsehQ8y1wMZl0-VsseZqM3NggN14qwNG7c&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
  The graph was generated using Gnuplot based on throughput values obtained from FlowMonitor. Both TCP and UDP achieve nearly equal throughput (~6.9 Mbps), indicating that the network is not congested. TCP maintains its transmission rate even in the presence of UDP traffic.
&lt;/p&gt;

&lt;h2&gt;FlowMonitor Output &amp;amp; Calculations&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;FlowMonitor Console Output 1&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjsT2K2aZ9kC_xybvqDxpbC3u5TFYy4PN_i29tEpjDjDoJDRN0BbsyKM2kSpOEZw6wlDrubFpGopzuNqw1Bl0Sev8dFrG_EWRnG0j45cFagU0cZxVtAnaO_m93P00cuUDgIIKsKL2P2HSjO4jnMbqiV3flbrC2QTeU2FCk5qJeftVmw6hfwEdsWxa7nDQc&quot; width=&quot;601&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;FlowMonitor Console Output 2&quot; height=&quot;255&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhzQgPJCjxJBcTU1FIFIAcH7Y4Uvtp2TDDrJDkOJAeB82Y84pkSuKaNuUfa1DPjbZk1SGbkjqTJ2cMhrdaWHu8iNqp2N-pvD1y8gs9bmQEhpTqv3YDe5VewPT9DJ11jNB5xZdHwgtK7M4chE20rsXimyClCLXNXNqIuu1o4-ip_cOLZoTa3nuCYlcV1sqI&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;Throughput is calculated using the formula:&lt;/p&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-left: 4px solid #007acc; padding: 10px 14px; font-family: &#39;Courier New&#39;, Consolas, monospace; overflow-x: auto;&quot;&gt;&lt;code&gt;Throughput (Mbps) = (rxBytes × 8) / (time × 1,000,000)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;For TCP:&lt;/b&gt;&lt;br /&gt;
&lt;code&gt;= (8,693,408 × 8) / (10 × 1,000,000) ≈ 6.95 Mbps&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;For UDP:&lt;/b&gt;&lt;br /&gt;
&lt;code&gt;Throughput = (8,649,896 × 8) / (10 × 1,000,000) ≈ 6.91 Mbps&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;
  The experiment demonstrates that both TCP and UDP can achieve similar throughput under low congestion conditions. However, UDP does not adjust its rate, whereas TCP adapts based on network conditions. This highlights the importance of congestion control in network performance.
&lt;/p&gt;
&lt;p&gt;
  Increasing UDP traffic can reduce TCP throughput due to congestion, showing unfair bandwidth sharing.
&lt;/p&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/2027841118463321658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/07/simulation-of-mixed-tcp-and-udp-traffic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/2027841118463321658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/2027841118463321658'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/07/simulation-of-mixed-tcp-and-udp-traffic.html' title='Simulation of Mixed TCP and UDP Traffic and Their Performance Impact Using ns3 | NS3 Project 16'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgI78rCb3yETO_X8pO3_UPi3uGRpvYSymEXv6v8q1Z0PDZ-yGYLdCGhbmZYOB3iG2dIiOE5jir2EYwZMHpBWG_Eh2ayrqfc5w3hYRqv-6VsvF3EIS9dDwdv7qsoLJm7_eRrso50fFBZipX7JkijFgl9YzgiMRI9eXz3k4QmPumb9ptdNmNzZMixW8Kq5MY=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-7480023138308569073</id><published>2026-06-15T09:00:00.000+05:30</published><updated>2026-09-09T08:25:31.709+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Implement a simple DNS query-response application over UDP sockets in NS3 | NS3 Project 15</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Simulation and Analysis of DNS Query-Response Mechanism over UDP in NS-3&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;Aim:&lt;/h2&gt;
&lt;p&gt;
  To design and simulate a DNS query-response mechanism over UDP sockets using NS3. The client sends &lt;code&gt;QUERY:&amp;lt;domain&amp;gt;&lt;/code&gt; packets to a DNS server through a router; the server replies with &lt;code&gt;ANSWER:&amp;lt;domain&amp;gt;:&amp;lt;ip&amp;gt;&lt;/code&gt; or &lt;code&gt;NXDOMAIN&lt;/code&gt;. The experiment measures throughput, delay, and packet delivery ratio, and visualises packet flow using NetAnim and Gnuplot.
&lt;/p&gt;

&lt;h2&gt;Prompt:&lt;/h2&gt;
&lt;blockquote style=&quot;background-color: #f9f9f9; border-left: 4px solid #ccc; margin: 1em 0; padding: 10px 16px; font-style: italic;&quot;&gt;
  &quot;Implement a simple DNS query-response application over UDP sockets in NS3. The simulation should include a DNS Client node, a Router, and a DNS Server node connected via point-to-point links. The client should send DNS queries (&lt;code&gt;QUERY:&amp;lt;domain&amp;gt;&lt;/code&gt;) and the server should respond with IP addresses (&lt;code&gt;ANSWER:&amp;lt;domain&amp;gt;:&amp;lt;ip&amp;gt;&lt;/code&gt;) or &lt;code&gt;NXDOMAIN&lt;/code&gt;. Include NetAnim animation output, FlowMonitor statistics, and Gnuplot graph generation for throughput and delay.&quot;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;LLM used:&lt;/strong&gt; Claude (Anthropic), Gemini&lt;/p&gt;

&lt;h2&gt;Source Code:&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/gnuplot.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/mobility-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;map&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #a6e22e;&quot;&gt;NS_LOG_COMPONENT_DEFINE&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DnsSimulation&quot;&lt;/span&gt;);

&lt;span style=&quot;color: #75715e;&quot;&gt;/* --- DNS Server Application --- */&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;DnsServerApp&lt;/span&gt; : &lt;span style=&quot;color: #66d9ef;&quot;&gt;public&lt;/span&gt; Application {
&lt;span style=&quot;color: #66d9ef;&quot;&gt;public:&lt;/span&gt;
    DnsServerApp() : m_port(53), m_socket(0), m_queryCount(0) {}

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; TypeId GetTypeId() {
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; TypeId tid = TypeId(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DnsServerApp&quot;&lt;/span&gt;)
            .SetParent&amp;lt;Application&amp;gt;()
            .SetGroupName(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Tutorial&quot;&lt;/span&gt;)
            .AddConstructor&amp;lt;DnsServerApp&amp;gt;();
        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; tid;
    }

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; Setup(uint16_t port) {
        m_port = port;
        m_dnsTable[&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;www.example.com&quot;&lt;/span&gt;] = &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;93.184.216.34&quot;&lt;/span&gt;;
        m_dnsTable[&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;www.google.com&quot;&lt;/span&gt;]  = &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;142.250.64.100&quot;&lt;/span&gt;;
    }

    uint32_t GetQueryCount() &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; { &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; m_queryCount; }

&lt;span style=&quot;color: #66d9ef;&quot;&gt;private:&lt;/span&gt;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;virtual void&lt;/span&gt; StartApplication() {
        m_socket = Socket::CreateSocket(GetNode(), UdpSocketFactory::GetTypeId());
        m_socket-&amp;gt;Bind(InetSocketAddress(Ipv4Address::GetAny(), m_port));
        m_socket-&amp;gt;SetRecvCallback(MakeCallback(&amp;amp;DnsServerApp::HandleRead, &lt;span style=&quot;color: #66d9ef;&quot;&gt;this&lt;/span&gt;));
    }

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; HandleRead(Ptr&amp;lt;Socket&amp;gt; socket) {
        Ptr&amp;lt;Packet&amp;gt; packet; 
        Address from;
        &lt;span style=&quot;color: #f92672;&quot;&gt;while&lt;/span&gt; ((packet = socket-&amp;gt;RecvFrom(from))) {
            uint8_t buf[256] = {0};
            packet-&amp;gt;CopyData(buf, &lt;span style=&quot;color: #66d9ef;&quot;&gt;sizeof&lt;/span&gt;(buf) - 1);
            std::string payload((&lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt;*)buf);
            &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (payload.find(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;QUERY:&quot;&lt;/span&gt;) == 0) {
                m_queryCount++;
                std::string domain = payload.substr(6);
                std::string response = &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ANSWER:&quot;&lt;/span&gt; + domain + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;:&quot;&lt;/span&gt; + 
                    (m_dnsTable.count(domain) ? m_dnsTable[domain] : &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;NXDOMAIN&quot;&lt;/span&gt;);
                Ptr&amp;lt;Packet&amp;gt; resp = Create&amp;lt;Packet&amp;gt;((&lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; uint8_t*)response.c_str(), response.size());
                socket-&amp;gt;SendTo(resp, 0, from);
            }
        }
    }

    uint16_t m_port;
    Ptr&amp;lt;Socket&amp;gt; m_socket;
    std::map&amp;lt;std::string, std::string&amp;gt; m_dnsTable;
    uint32_t m_queryCount;
};

&lt;span style=&quot;color: #75715e;&quot;&gt;/* --- DNS Client Application --- */&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;DnsClientApp&lt;/span&gt; : &lt;span style=&quot;color: #66d9ef;&quot;&gt;public&lt;/span&gt; Application {
&lt;span style=&quot;color: #66d9ef;&quot;&gt;public:&lt;/span&gt;
    DnsClientApp() : m_socket(0), m_queryIndex(0) {}

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; TypeId GetTypeId() {
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; TypeId tid = TypeId(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DnsClientApp&quot;&lt;/span&gt;)
            .SetParent&amp;lt;Application&amp;gt;()
            .SetGroupName(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Tutorial&quot;&lt;/span&gt;)
            .AddConstructor&amp;lt;DnsClientApp&amp;gt;();
        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; tid;
    }

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; Setup(Ipv4Address addr, uint16_t port) {
        m_serverAddr = addr;
        m_serverPort = port;
        m_domains = {&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;www.example.com&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;www.google.com&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;www.ns3sim.net&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;www.unknown.org&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;mail.example.com&quot;&lt;/span&gt;};
    }

&lt;span style=&quot;color: #66d9ef;&quot;&gt;private:&lt;/span&gt;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;virtual void&lt;/span&gt; StartApplication() {
        m_socket = Socket::CreateSocket(GetNode(), UdpSocketFactory::GetTypeId());
        m_socket-&amp;gt;Connect(InetSocketAddress(m_serverAddr, m_serverPort));
        m_sendEvent = Simulator::Schedule(Seconds(1.0), &amp;amp;DnsClientApp::SendQuery, &lt;span style=&quot;color: #66d9ef;&quot;&gt;this&lt;/span&gt;);
    }

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;void&lt;/span&gt; SendQuery() {
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (m_queryIndex &amp;lt; m_domains.size()) {
            std::string q = &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;QUERY:&quot;&lt;/span&gt; + m_domains[m_queryIndex++];
            m_socket-&amp;gt;Send(Create&amp;lt;Packet&amp;gt;((&lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; uint8_t*)q.c_str(), q.size()));
            m_sendEvent = Simulator::Schedule(Seconds(1.0), &amp;amp;DnsClientApp::SendQuery, &lt;span style=&quot;color: #66d9ef;&quot;&gt;this&lt;/span&gt;);
        }
    }

    Ipv4Address m_serverAddr;
    uint16_t m_serverPort;
    Ptr&amp;lt;Socket&amp;gt; m_socket;
    EventId m_sendEvent;
    std::vector&amp;lt;std::string&amp;gt; m_domains;
    uint32_t m_queryIndex;
};

&lt;span style=&quot;color: #75715e;&quot;&gt;/* --- Main Simulation --- */&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt;* argv[]) {
    CommandLine cmd;
    cmd.Parse(argc, argv);

    NodeContainer nodes;
    nodes.Create(3);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Mobility&lt;/span&gt;
    MobilityHelper mobility;
    Ptr&amp;lt;ListPositionAllocator&amp;gt; positionAlloc = CreateObject&amp;lt;ListPositionAllocator&amp;gt;();
    positionAlloc-&amp;gt;Add(Vector(10.0, 50.0, 0.0));
    positionAlloc-&amp;gt;Add(Vector(50.0, 50.0, 0.0));
    positionAlloc-&amp;gt;Add(Vector(90.0, 50.0, 0.0));
    mobility.SetPositionAllocator(positionAlloc);
    mobility.SetMobilityModel(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::ConstantPositionMobilityModel&quot;&lt;/span&gt;);
    mobility.Install(nodes);

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;2ms&quot;&lt;/span&gt;));

    NetDeviceContainer d01 = p2p.Install(nodes.Get(0), nodes.Get(1));
    NetDeviceContainer d12 = p2p.Install(nodes.Get(1), nodes.Get(2));

    InternetStackHelper stack;
    stack.Install(nodes);

    Ipv4AddressHelper address;
    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    address.Assign(d01);

    address.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.2.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer i12 = address.Assign(d12);

    Ipv4GlobalRoutingHelper::PopulateRoutingTables();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// NetAnim&lt;/span&gt;
    AnimationInterface anim(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;dns-anim.xml&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(nodes.Get(0), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Client&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(nodes.Get(1), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Router&quot;&lt;/span&gt;);
    anim.UpdateNodeDescription(nodes.Get(2), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Server&quot;&lt;/span&gt;);
    p2p.EnablePcapAll(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;dns-trace&quot;&lt;/span&gt;);

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Applications&lt;/span&gt;
    Ptr&amp;lt;DnsServerApp&amp;gt; server = CreateObject&amp;lt;DnsServerApp&amp;gt;();
    server-&amp;gt;Setup(53);
    nodes.Get(2)-&amp;gt;AddApplication(server);
    server-&amp;gt;SetStartTime(Seconds(1.0));

    Ptr&amp;lt;DnsClientApp&amp;gt; client = CreateObject&amp;lt;DnsClientApp&amp;gt;();
    client-&amp;gt;Setup(i12.GetAddress(1), 53);
    nodes.Get(0)-&amp;gt;AddApplication(client);
    client-&amp;gt;SetStartTime(Seconds(2.0));

    FlowMonitorHelper flowmon;
    Ptr&amp;lt;FlowMonitor&amp;gt; monitor = flowmon.InstallAll();

    Simulator::Stop(Seconds(15.0));
    Simulator::Run();

    &lt;span style=&quot;color: #75715e;&quot;&gt;// Gnuplot&lt;/span&gt;
    Gnuplot plot(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;throughput.png&quot;&lt;/span&gt;);
    plot.SetTitle(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Throughput vs Flow ID&quot;&lt;/span&gt;);
    plot.SetTerminal(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;png&quot;&lt;/span&gt;);
    Gnuplot2dDataset dataset;
    dataset.SetStyle(Gnuplot2dDataset::LINES_POINTS);

    monitor-&amp;gt;CheckForLostPackets();
    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier = DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowmon.GetClassifier());
    std::map&amp;lt;FlowId, FlowMonitor::FlowStats&amp;gt; stats = monitor-&amp;gt;GetFlowStats();

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n--- Flow Statistics ---&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt; it = stats.begin(); it != stats.end(); ++it) {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(it-&amp;gt;first);
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; duration = it-&amp;gt;second.timeLastRxPacket.GetSeconds() - it-&amp;gt;second.timeFirstTxPacket.GetSeconds();
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughput = (duration &amp;gt; 0) ? (it-&amp;gt;second.rxBytes * 8.0 / (duration * 1000.0)) : 0;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Flow &quot;&lt;/span&gt; &amp;lt;&amp;lt; it-&amp;gt;first &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; (&quot;&lt;/span&gt; &amp;lt;&amp;lt; t.sourceAddress &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; -&amp;gt; &quot;&lt;/span&gt; &amp;lt;&amp;lt; t.destinationAddress &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;): &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; throughput &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; kbps [Rx Packets: &quot;&lt;/span&gt; &amp;lt;&amp;lt; it-&amp;gt;second.rxPackets &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;]&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;
        dataset.Add((&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;)it-&amp;gt;first, throughput);
    }

    plot.AddDataset(dataset);
    std::ofstream plotFile(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;dns-throughput.plt&quot;&lt;/span&gt;);
    plot.GenerateOutput(plotFile);
    plotFile.close();

    Simulator::Destroy();
    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Graph:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Throughput vs Flow ID Graph&quot; height=&quot;451&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg0SYgzghor4_bi-nm8mZqXbEnUd2kQaHje8LfRunyANZb0yzt7XAkQhcrl9KdbZpjd3GpdzOFjiSWU1CIPvBLO-Be9ya2ORSZAhAV6E_oCy2KT1IJtCWNHpHpM641Pw7Hi9_oVeFW-9fGaJjoEAehyQkPVoA5m8ID14_DtLyRlX6rr9pUQ-yw0L12IB24&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The graph plots throughput (in kbps) on the Y-axis against Flow ID on the X-axis. Two flows are recorded — Flow 1 (client → server, DNS query direction) and Flow 2 (server → client, DNS response direction).
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Flow 1 throughput:&lt;/b&gt; ~0.484 kbps&lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Flow 2 throughput:&lt;/b&gt; ~0.608 kbps&lt;/li&gt;
  &lt;li&gt;The relationship is linear and increasing from Flow 1 to Flow 2.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;NetAnim:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Animation Screenshot 1&quot; height=&quot;319&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgKVA3s8IFrUrm6Em2Ah6i04HnaoXBuiK0d3LuVUlv52-SVeV9XR3yWaQW2WXUBrvi2U5n0OLXN7JwhAj3jQifr5iNk5bOiKzx5lYUG3ZAzDdO05ljKLaIl_hinoRdb-wqKl54IGm8sYjnWgN57PLttJC2j5gx6dwceX3i1cShca7aZ7adWMTgVBJXZPek&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;NetAnim Animation Screenshot 2&quot; height=&quot;321&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhBg3c0InWB5dSWbop0vHC4bvstuAtsSXH1QHO1xmI8WX74OhuYuZ8bDH21KloN7a56CRXIEDZP_8gg02_oe5UXYkcvJv0AVoWp8CfI7_Xm2FAqCs80pTbk81s8InAEmULxrg9D7ro84Ubpcs5iOZBUFyhTGUV_oXW9zfCxI5Kx4ZymuiiCHGVzNZYukbE&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  Linear 3-node chain — Client connected to Router via P2P, Router to DNS Server via P2P. Animated arrows show DNS query packets traversing the network and response packets returning. All routing via &lt;code&gt;Ipv4GlobalRoutingHelper&lt;/code&gt;.
&lt;/p&gt;

&lt;h2&gt;Wireshark:&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark Trace 1&quot; height=&quot;423&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhV_EVqRto0pd8ckasFWq7C04aEV9SA1yroM9iLVTAIuoK1z7gcsud1h0DuUT5Gk_eD5_oHyfdOF_1HRoeLzp5NVz5a50oqUCA7EBtq7WFTFeyusXFVTb-bLl9YJMio99MGQDmd_VHk9i95zQshvC0qX6c3OJeWBZ9oPkIRhJuoyE7elKXNWKbF3Gk5D5w&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Wireshark Trace 2&quot; height=&quot;426&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhw2N1qrIvj4o9iTtMUl67uXDHSZpOC0OdlULFItPslmb1lh_of_Cn5vg6FitzABqfQ7vcU-cNPs1lVZolcYChhT3kXqiiorOzbsb7U0UTD7GFrIdxceEXyqRD8dFE0nKnek7AOXunuAPEjvBITzByHNCJytjDS0RTAR325WQ8luY49UBHk0XZpgbjX588&quot; width=&quot;601&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Wireshark Trace 3&quot; height=&quot;425&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjKHcz9mI4Bu35BQuYaVzdZBJKYdLrCze4eqUoDtrZGpnM1G_aXUra9k0jMl34tJIMA7kpvmwHV19m1H-TawDnsJlSWeZnlH_u_Sz1BvMja3ZEOMeiot6KWowY_jYtzSMYApuUm0fiEKHk1S_rwztSggiv8xEqatHwHW8L_5eVFAjCaZxCNiPvxxOTv2SU&quot; width=&quot;602&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Wireshark Trace 4&quot; height=&quot;413&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhlEx4jWC9AI2TmqVbQ18nReENU962oV4JVP42UVprZ_R_U5H49A7U8WEZWK3scfI6qxRg8sDj1o4q9jwdbjNVCLvVOxprGT7d-NFhV_C_mxrnGHwz_D_vGUHWTGhNvVYPJJICT7nUvDOXCWSgyBgrVC1AGLJE7DhxTuPcoI3mN6g3XVMcXozTG32GJpGs&quot; width=&quot;601&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/7480023138308569073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/06/implement-simple-dns-query-response.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/7480023138308569073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/7480023138308569073'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/06/implement-simple-dns-query-response.html' title='Implement a simple DNS query-response application over UDP sockets in NS3 | NS3 Project 15'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEg0SYgzghor4_bi-nm8mZqXbEnUd2kQaHje8LfRunyANZb0yzt7XAkQhcrl9KdbZpjd3GpdzOFjiSWU1CIPvBLO-Be9ya2ORSZAhAV6E_oCy2KT1IJtCWNHpHpM641Pw7Hi9_oVeFW-9fGaJjoEAehyQkPVoA5m8ID14_DtLyRlX6rr9pUQ-yw0L12IB24=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8826608353769320919.post-5955565487103046694</id><published>2026-06-14T09:00:00.000+05:30</published><updated>2026-09-09T08:29:25.571+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Network Simulator 3"/><category scheme="http://www.blogger.com/atom/ns#" term="NS3"/><title type='text'>Performance Analysis of TCP Reno Congestion Control Under Varying Round-Trip Time Conditions | NS3 Project 14</title><content type='html'>&lt;h1 style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Performance Analysis of TCP Reno Congestion Control Under Varying Round-Trip Time Conditions: An ns-3 Simulation Study&lt;/b&gt;&lt;/h1&gt;

&lt;h2&gt;PROMPT&lt;/h2&gt;

&lt;h3&gt;Part 1:&lt;/h3&gt;
&lt;p&gt;
  You are an expert in ns-3 network simulation and C++.&lt;br /&gt;
  I want you to design and implement a complete ns-3 simulation in C++ to analyze the performance of TCP Reno over a point-to-point link with varying RTT values (10 ms to 200 ms).
&lt;/p&gt;

&lt;h4&gt;Requirements:&lt;/h4&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;strong&gt;Simulation Setup&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Create a point-to-point network topology (2 nodes).&lt;/li&gt;
      &lt;li&gt;Configure link parameters such as:
        &lt;ul&gt;
          &lt;li&gt;Data rate (choose a reasonable default like 5 Mbps or 10 Mbps)&lt;/li&gt;
          &lt;li&gt;Packet size&lt;/li&gt;
          &lt;li&gt;Queue type (DropTail or similar)&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;Use TCP Reno as the transport protocol.&lt;/li&gt;
      &lt;li&gt;Ensure RTT variation is achieved by modifying propagation delay (range: 10 ms to 200 ms in steps).&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Traffic Configuration&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Use a TCP application (e.g., BulkSendApplication or OnOffApplication).&lt;/li&gt;
      &lt;li&gt;Configure a receiver using PacketSink.&lt;/li&gt;
      &lt;li&gt;Run simulations for multiple RTT values.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Metrics to Analyze&lt;/strong&gt;&lt;br /&gt;
    Collect and output the following:
    &lt;ul&gt;
      &lt;li&gt;Throughput&lt;/li&gt;
      &lt;li&gt;Packet loss&lt;/li&gt;
      &lt;li&gt;End-to-end delay&lt;/li&gt;
      &lt;li&gt;Congestion window (cwnd) behavior over time&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Tracing and Logging&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Enable trace files for:
        &lt;ul&gt;
          &lt;li&gt;Congestion window (cwnd)&lt;/li&gt;
          &lt;li&gt;Packet drops&lt;/li&gt;
          &lt;li&gt;Throughput&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;Generate a trace matrix (trace files/logs) that can be used for analysis.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;NetAnim Visualization&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Integrate NetAnim:
        &lt;ul&gt;
          &lt;li&gt;Generate an XML animation file.&lt;/li&gt;
          &lt;li&gt;Ensure node positions and packet flows are visible.&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;PCAP / Wireshark Support&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Enable PCAP tracing so that the simulation output can be analyzed in Wireshark.&lt;/li&gt;
      &lt;li&gt;Clearly mention how to open and inspect the generated PCAP files.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Graph Generation (Gnuplot)&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Generate output files compatible with Gnuplot.&lt;/li&gt;
      &lt;li&gt;Provide scripts or instructions to plot:
        &lt;ul&gt;
          &lt;li&gt;RTT vs Throughput&lt;/li&gt;
          &lt;li&gt;RTT vs Packet Loss&lt;/li&gt;
          &lt;li&gt;Time vs Congestion Window&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Code Structure&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Write clean, modular C++ code compatible with ns-3.&lt;/li&gt;
      &lt;li&gt;Include comments explaining each section.&lt;/li&gt;
      &lt;li&gt;Ensure the code compiles and runs without errors.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Execution Instructions&lt;/strong&gt;&lt;br /&gt;
    After writing the code, provide:
    &lt;ul&gt;
      &lt;li&gt;Steps to compile and run the simulation in ns-3&lt;/li&gt;
      &lt;li&gt;Commands to enable tracing&lt;/li&gt;
      &lt;li&gt;Steps to view:
        &lt;ul&gt;
          &lt;li&gt;NetAnim visualization&lt;/li&gt;
          &lt;li&gt;Wireshark (PCAP files)&lt;/li&gt;
          &lt;li&gt;Gnuplot graphs&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;strong&gt;Expected Output Explanation&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Briefly explain what trends are expected when RTT increases (e.g., effect on throughput and cwnd).&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Part 2:&lt;/h3&gt;
&lt;p&gt;
  You are an expert in ns-3 and C++.&lt;br /&gt;
  I have already implemented a TCP Reno RTT analysis simulation in ns-3. Now I want you to update and refine the existing implementation with the following changes:
&lt;/p&gt;

&lt;h4&gt;1. Integrate FlowMonitor&lt;/h4&gt;
&lt;p&gt;
  Enhance the simulation by adding FlowMonitor to collect detailed performance metrics.&lt;br /&gt;
  Include FlowMonitor module: &lt;code&gt;#include &quot;ns3/flow-monitor-module.h&quot;&lt;/code&gt;
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Install FlowMonitor on all nodes.&lt;/li&gt;
  &lt;li&gt;Collect and compute:
    &lt;ul&gt;
      &lt;li&gt;Throughput per flow&lt;/li&gt;
      &lt;li&gt;Packet loss&lt;/li&gt;
      &lt;li&gt;Delay statistics&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Output results in a readable format (console + optional XML file).&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;2. Output Enhancements&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;Ensure FlowMonitor results are:
    &lt;ul&gt;
      &lt;li&gt;Printed clearly after simulation ends&lt;/li&gt;
      &lt;li&gt;Optionally exported to an XML file (e.g., flowmon.xml)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;3. Maintain Existing Features&lt;/h4&gt;
&lt;p&gt;Make sure the following features remain intact:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;RTT variation (10 ms to 200 ms)&lt;/li&gt;
  &lt;li&gt;NetAnim XML generation&lt;/li&gt;
  &lt;li&gt;PCAP tracing (for Wireshark)&lt;/li&gt;
  &lt;li&gt;Trace files (cwnd, drops, etc.)&lt;/li&gt;
  &lt;li&gt;Gnuplot-compatible output&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;4. Code Quality&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;Keep the code modular and well-commented&lt;/li&gt;
  &lt;li&gt;Avoid redundancy while integrating FlowMonitor&lt;/li&gt;
  &lt;li&gt;Ensure compatibility with standard ns-3 versions&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;5. Execution Instructions Update&lt;/h4&gt;
&lt;p&gt;Update the run instructions to reflect:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;New filename (&lt;code&gt;tcp-reno-rtt-analysis.cc&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;FlowMonitor output usage&lt;/li&gt;
  &lt;li&gt;Any new compilation flags if required&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;CODE:&lt;/h2&gt;
&lt;pre style=&quot;background-color: #121212; color: #f8f8f2; border: 1px solid #333333; border-radius: 6px; padding: 16px; font-family: &#39;Courier New&#39;, Consolas, Monaco, monospace; font-size: 13px; line-height: 1.5; overflow-x: auto;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #75715e;&quot;&gt;/* =================================================================== 
* TCP Reno Performance Analysis over a Point-to-Point Link with Varying RTT 
* ns-3 version : 3.42 
* Author ID    : 24BPS1135 
* ─────────────────────────────────────────────────────────────────────
* TOPOLOGY  (one instance per simulation run) 
* ───────────────────────────────────────────────────────────────────── 
*   n0 (BulkSend) ──────[P2P  10 Mbps | delay = RTT/2]────── n1 (PacketSink) 
* ──────────────────────────────────────────────────────────────────── 
* WHAT THIS SIMULATION DOES 
* ───────────────────────────────────────────────────────────────────── 
*   Sweeps RTT values {10, 25, 50, 75, 100, 125, 150, 175, 200} ms by running 
*   9 back-to-back ns-3 simulations. Each run collects: 
* 
*   Via FlowMonitor 
*     • Throughput (Mbps) 
*     • Goodput (Mbps)          – application-layer useful bytes / time 
*     • Packet loss ratio 
*     • Average / min / max end-to-end delay (ms) 
*     • Mean jitter (ms) 
*     • Tx / Rx packet &amp;amp; byte counts 
* 
*   Via trace callbacks 
*     • Congestion window over time  →  cwnd_rtt_Xms.dat 
* ──────────────────────────────────────────────────────────────────── 
* OUTPUT FILES   (all written to scratch/results/) 
* ───────────────────────────────────────────────────────────────────── 
*   summary.dat                RTT | Throughput | Goodput | Loss | Delay | Jitter 
*   cwnd_rtt_Xms.dat          Time(s) | cwnd(segments)        – one file per RTT 
*   flowmon_rtt_Xms.xml        FlowMonitor XML export            – one file per RTT 
*   tcp-reno-rtt-Xms.tr        ASCII link-level trace            – one file per RTT 
*   tcp-reno-rtt-0-0.pcap      Sender   PCAP  (RTT = 10 ms only) 
*   tcp-reno-rtt-0-1.pcap      Receiver PCAP  (RTT = 10 ms only) 
*   tcp-reno-netanim.xml      NetAnim animation  (RTT = 10 ms only) 
* ──────────────────────────────────────────────────────────────────── 
* COMPILE &amp;amp; RUN  (from the ns-3 root directory) 
* ────────────────────────────────────────────────────────────────────
*   mkdir -p scratch/results 
*   ./ns3 build scratch/24BPS1135 
*   ./ns3 run   scratch/24BPS1135 
* 
* VISUALISE 
*   Wireshark  : wireshark scratch/results/tcp-reno-rtt-0-0.pcap 
*   NetAnim    : ./netanim-3.109/NetAnim  →  open tcp-reno-netanim.xml 
*   FlowMonitor: open scratch/results/flowmon_rtt_Xms.xml in any XML viewer 
*   Gnuplot    : gnuplot scratch/plot_throughput.plt 
*                gnuplot scratch/plot_loss.plt 
*                gnuplot scratch/plot_cwnd.plt 
* ===================================================================== */&lt;/span&gt;

&lt;span style=&quot;color: #75715e;&quot;&gt;// ── Standard library ──────────────────────────────────────────────────────────&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;iomanip&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;sstream&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&amp;lt;sys/stat.h&amp;gt;&lt;/span&gt;       &lt;span style=&quot;color: #75715e;&quot;&gt;// POSIX mkdir(2)&lt;/span&gt;

&lt;span style=&quot;color: #75715e;&quot;&gt;// ── ns-3 modules ──────────────────────────────────────────────────────────────&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/applications-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/core-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/flow-monitor-module.h&quot;&lt;/span&gt;   &lt;span style=&quot;color: #75715e;&quot;&gt;// FlowMonitor – per-flow statistics&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/internet-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/netanim-module.h&quot;&lt;/span&gt;        &lt;span style=&quot;color: #75715e;&quot;&gt;// NetAnim XML animation&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/network-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/point-to-point-module.h&quot;&lt;/span&gt;
&lt;span style=&quot;color: #f92672;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3/traffic-control-module.h&quot;&lt;/span&gt;

&lt;span style=&quot;color: #66d9ef;&quot;&gt;using namespace&lt;/span&gt; ns3;

&lt;span style=&quot;color: #a6e22e;&quot;&gt;NS_LOG_COMPONENT_DEFINE&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;24BPS1135&quot;&lt;/span&gt;);

&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  GLOBAL STATE&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; std::ofstream g_cwndStream;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; std::ofstream g_summaryStream;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static&lt;/span&gt; uint32_t g_segmentSize = 1024; &lt;span style=&quot;color: #75715e;&quot;&gt;// bytes&lt;/span&gt;

&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  TRACE CALLBACKS&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static void&lt;/span&gt;
&lt;span style=&quot;color: #a6e22e;&quot;&gt;CwndChange&lt;/span&gt;(uint32_t &lt;span style=&quot;color: #75715e;&quot;&gt;/* oldCwnd */&lt;/span&gt;, uint32_t newCwnd)
{
    g_cwndStream &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(6)
                 &amp;lt;&amp;lt; Simulator::Now().GetSeconds()                   &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt;
                 &amp;lt;&amp;lt; &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(newCwnd) / g_segmentSize   &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  HELPER: connect the cwnd trace source after the TCP socket exists&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static void&lt;/span&gt;
&lt;span style=&quot;color: #a6e22e;&quot;&gt;ConnectCwndTrace&lt;/span&gt;()
{
    Config::ConnectWithoutContext(
        &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/NodeList/0/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow&quot;&lt;/span&gt;,
        MakeCallback(&amp;amp;CwndChange));
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  FLOWMONITOR REPORTING&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static void&lt;/span&gt;
&lt;span style=&quot;color: #a6e22e;&quot;&gt;PrintFlowMonitorStats&lt;/span&gt;(Ptr&amp;lt;FlowMonitor&amp;gt;       monitor,
                      FlowMonitorHelper&amp;amp;     flowHelper,
                      uint32_t               port,
                      uint32_t               rttMs,
                      &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; std::string&amp;amp;     xmlFile,
                      &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;amp;                tput,
                      &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;amp;                loss,
                      &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;amp;                delay,
                      &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;amp;                jitter)
{
    monitor-&amp;gt;CheckForLostPackets();
    monitor-&amp;gt;SerializeToXmlFile(xmlFile, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    FlowMonitor XML → &quot;&lt;/span&gt; &amp;lt;&amp;lt; xmlFile &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;

    Ptr&amp;lt;Ipv4FlowClassifier&amp;gt; classifier =
        DynamicCast&amp;lt;Ipv4FlowClassifier&amp;gt;(flowHelper.GetClassifier());
    FlowMonitor::FlowStatsContainer stats = monitor-&amp;gt;GetFlowStats();

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    ┌─────────────────────────────────────────────────┐\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    │  FlowMonitor Report  –  RTT = &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(4) &amp;lt;&amp;lt; rttMs
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ms                 │\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    └─────────────────────────────────────────────────┘\n&quot;&lt;/span&gt;;

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;bool&lt;/span&gt; flowFound = &lt;span style=&quot;color: #ae81ff;&quot;&gt;false&lt;/span&gt;;
    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #66d9ef;&quot;&gt;auto&lt;/span&gt;&amp;amp; kv : stats)
    {
        Ipv4FlowClassifier::FiveTuple t = classifier-&amp;gt;FindFlow(kv.first);
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (t.destinationPort != port)
            &lt;span style=&quot;color: #f92672;&quot;&gt;continue&lt;/span&gt;;

        flowFound = &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; FlowMonitor::FlowStats&amp;amp; fs = kv.second;

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; durationSec = (fs.timeLastRxPacket - fs.timeFirstRxPacket).GetSeconds();
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughputMbps = 0.0;
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (durationSec &amp;gt; 0.0)
            throughputMbps = (&lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.rxBytes) * 8.0) / (durationSec * 1.0e6);

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; uint32_t hdrBytes = 40;
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; payloadBytes = (fs.rxBytes &amp;gt; fs.rxPackets * hdrBytes)
                              ? &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.rxBytes - fs.rxPackets * hdrBytes)
                              : &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.rxBytes);
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; goodputMbps = 0.0;
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (durationSec &amp;gt; 0.0)
            goodputMbps = (payloadBytes * 8.0) / (durationSec * 1.0e6);

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; lossRatio = 0.0;
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (fs.txPackets &amp;gt; 0)
            lossRatio = &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.lostPackets) / &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.txPackets);

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; avgDelayMs = 0.0;
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (fs.rxPackets &amp;gt; 0)
            avgDelayMs = (fs.delaySum.GetSeconds() * 1000.0) / &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.rxPackets);

        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; meanJitterMs = 0.0;
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (fs.rxPackets &amp;gt; 1)
            meanJitterMs = (fs.jitterSum.GetSeconds() * 1000.0) / &lt;span style=&quot;color: #66d9ef;&quot;&gt;static_cast&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt;&amp;gt;(fs.rxPackets - 1);

        std::cout &amp;lt;&amp;lt; std::fixed
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Flow ID      : &quot;&lt;/span&gt; &amp;lt;&amp;lt; kv.first &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Src → Dst    : &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; t.sourceAddress      &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;:&quot;&lt;/span&gt; &amp;lt;&amp;lt; t.sourcePort &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  →  &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; t.destinationAddress &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;:&quot;&lt;/span&gt; &amp;lt;&amp;lt; t.destinationPort &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Protocol     : &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; (t.protocol == 6 ? &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;TCP&quot;&lt;/span&gt; : &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;UDP&quot;&lt;/span&gt;) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    ─── Packet counters ──────────────────────────────\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Tx packets   : &quot;&lt;/span&gt; &amp;lt;&amp;lt; fs.txPackets  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Rx packets   : &quot;&lt;/span&gt; &amp;lt;&amp;lt; fs.rxPackets  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Lost packets : &quot;&lt;/span&gt; &amp;lt;&amp;lt; fs.lostPackets
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;  (&quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setprecision(4) &amp;lt;&amp;lt; lossRatio * 100.0 &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; %)\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Tx bytes     : &quot;&lt;/span&gt; &amp;lt;&amp;lt; fs.txBytes    &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Rx bytes     : &quot;&lt;/span&gt; &amp;lt;&amp;lt; fs.rxBytes    &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    ─── Throughput ───────────────────────────────────\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Throughput   : &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setprecision(4)
                                          &amp;lt;&amp;lt; throughputMbps &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Goodput      : &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setprecision(4)
                                          &amp;lt;&amp;lt; goodputMbps   &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; Mbps\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    ─── Delay (end-to-end) ───────────────────────────\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Avg delay    : &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setprecision(3)
                                          &amp;lt;&amp;lt; avgDelayMs    &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ms\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    (min/max per-pkt delay not tracked by ns-3 FlowStats)\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    ─── Jitter ───────────────────────────────────────\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    Mean jitter  : &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setprecision(3)
                                          &amp;lt;&amp;lt; meanJitterMs  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ms\n&quot;&lt;/span&gt;;

        tput   = throughputMbps;
        loss   = lossRatio;
        delay  = avgDelayMs;
        jitter = meanJitterMs;
    }

    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (!flowFound)
    {
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;    WARNING: no matching flow found (port &quot;&lt;/span&gt; &amp;lt;&amp;lt; port &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;)\n&quot;&lt;/span&gt;;
    }
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  RunSimulation&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;static void&lt;/span&gt;
&lt;span style=&quot;color: #a6e22e;&quot;&gt;RunSimulation&lt;/span&gt;(uint32_t           rttMs,
              &lt;span style=&quot;color: #66d9ef;&quot;&gt;bool&lt;/span&gt;               enablePcap,
              &lt;span style=&quot;color: #66d9ef;&quot;&gt;bool&lt;/span&gt;               enableNetAnim,
              &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; std::string&amp;amp; resultsDir)
{
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;const double&lt;/span&gt;   simTime   = 30.0;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; uint32_t port      = 9;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; uint32_t halfRttMs = rttMs / 2;
    g_segmentSize = 1024;

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n╔══════════════════════════════════════════════════╗\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  RTT = &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(4) &amp;lt;&amp;lt; rttMs
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ms   (one-way delay = &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(3) &amp;lt;&amp;lt; halfRttMs
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ms)          ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╚══════════════════════════════════════════════════╝\n&quot;&lt;/span&gt;;

    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpL4Protocol::SocketType&quot;&lt;/span&gt;,
                       TypeIdValue(TypeId::LookupByName(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpLinuxReno&quot;&lt;/span&gt;)));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpL4Protocol::RecoveryType&quot;&lt;/span&gt;,
                       TypeIdValue(TypeId::LookupByName(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpClassicRecovery&quot;&lt;/span&gt;)));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::SndBufSize&quot;&lt;/span&gt;,  UintegerValue(1 &amp;lt;&amp;lt; 20));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::RcvBufSize&quot;&lt;/span&gt;,  UintegerValue(1 &amp;lt;&amp;lt; 20));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::SegmentSize&quot;&lt;/span&gt;, UintegerValue(g_segmentSize));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::InitialCwnd&quot;&lt;/span&gt;, UintegerValue(1));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocket::DelAckCount&quot;&lt;/span&gt;, UintegerValue(1));
    Config::SetDefault(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketBase::Sack&quot;&lt;/span&gt;,    BooleanValue(&lt;span style=&quot;color: #ae81ff;&quot;&gt;false&lt;/span&gt;));

    NodeContainer nodes;
    nodes.Create(2);

    std::ostringstream delayOss;
    delayOss &amp;lt;&amp;lt; halfRttMs &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ms&quot;&lt;/span&gt;;

    PointToPointHelper p2p;
    p2p.SetDeviceAttribute (&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;DataRate&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10Mbps&quot;&lt;/span&gt;));
    p2p.SetChannelAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Delay&quot;&lt;/span&gt;,    StringValue(delayOss.str()));
    p2p.SetQueue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::DropTailQueue&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxSize&quot;&lt;/span&gt;, StringValue(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;100p&quot;&lt;/span&gt;));
    NetDeviceContainer devices = p2p.Install(nodes);

    InternetStackHelper internet;
    internet.Install(nodes);

    Ipv4AddressHelper ipv4;
    ipv4.SetBase(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;10.1.1.0&quot;&lt;/span&gt;, &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;255.255.255.0&quot;&lt;/span&gt;);
    Ipv4InterfaceContainer interfaces = ipv4.Assign(devices);

    Address receiverAddr(InetSocketAddress(interfaces.GetAddress(1), port));

    BulkSendHelper bulkSend(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;, receiverAddr);
    bulkSend.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;MaxBytes&quot;&lt;/span&gt;, UintegerValue(0));
    bulkSend.SetAttribute(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;SendSize&quot;&lt;/span&gt;, UintegerValue(g_segmentSize));
    ApplicationContainer senderApps = bulkSend.Install(nodes.Get(0));
    senderApps.Start(Seconds(1.0));
    senderApps.Stop (Seconds(simTime));

    PacketSinkHelper packetSink(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ns3::TcpSocketFactory&quot;&lt;/span&gt;,
                                InetSocketAddress(Ipv4Address::GetAny(), port));
    ApplicationContainer sinkApps = packetSink.Install(nodes.Get(1));
    sinkApps.Start(Seconds(0.5));
    sinkApps.Stop (Seconds(simTime + 1.0));

    std::ostringstream cwndFilename;
    cwndFilename &amp;lt;&amp;lt; resultsDir &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/cwnd_rtt_&quot;&lt;/span&gt; &amp;lt;&amp;lt; rttMs &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ms.dat&quot;&lt;/span&gt;;
    g_cwndStream.open(cwndFilename.str());
    g_cwndStream &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;# Time(s)\tcwnd(segments)   [RTT=&quot;&lt;/span&gt; &amp;lt;&amp;lt; rttMs &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ms]\n&quot;&lt;/span&gt;;

    Simulator::Schedule(Seconds(1.001), &amp;amp;ConnectCwndTrace);

    FlowMonitorHelper flowHelper;
    Ptr&amp;lt;FlowMonitor&amp;gt;  monitor = flowHelper.InstallAll();

    AsciiTraceHelper ascii;
    std::string trFilename = resultsDir + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/tcp-reno-rtt-&quot;&lt;/span&gt; + std::to_string(rttMs) + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ms.tr&quot;&lt;/span&gt;;
    p2p.EnableAsciiAll(ascii.CreateFileStream(trFilename));

    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (enablePcap)
    {
        std::string pcapPrefix = resultsDir + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/tcp-reno-rtt&quot;&lt;/span&gt;;
        p2p.EnablePcapAll(pcapPrefix, &lt;span style=&quot;color: #ae81ff;&quot;&gt;false&lt;/span&gt;);
    }

    AnimationInterface* anim = &lt;span style=&quot;color: #66d9ef;&quot;&gt;nullptr&lt;/span&gt;;
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (enableNetAnim)
    {
        std::string animFilename = resultsDir + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/tcp-reno-netanim.xml&quot;&lt;/span&gt;;
        anim = &lt;span style=&quot;color: #66d9ef;&quot;&gt;new&lt;/span&gt; AnimationInterface(animFilename);
        anim-&amp;gt;SetConstantPosition(nodes.Get(0), 10.0, 30.0);
        anim-&amp;gt;SetConstantPosition(nodes.Get(1), 70.0, 30.0);
        anim-&amp;gt;UpdateNodeDescription(nodes.Get(0), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;n0  Sender (BulkSend)&quot;&lt;/span&gt;);
        anim-&amp;gt;UpdateNodeDescription(nodes.Get(1), &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;n1  Receiver (PacketSink)&quot;&lt;/span&gt;);
        anim-&amp;gt;UpdateNodeSize(nodes.Get(0)-&amp;gt;GetId(), 4.0, 4.0);
        anim-&amp;gt;UpdateNodeSize(nodes.Get(1)-&amp;gt;GetId(), 4.0, 4.0);
        anim-&amp;gt;EnablePacketMetadata(&lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);
    }

    Simulator::Stop(Seconds(simTime + 2.0));
    Simulator::Run();

    std::string xmlFile = resultsDir + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/flowmon_rtt_&quot;&lt;/span&gt; + std::to_string(rttMs) + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ms.xml&quot;&lt;/span&gt;;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; throughputMbps = 0.0;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; lossRatio      = 0.0;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; avgDelayMs     = 0.0;
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; meanJitterMs   = 0.0;

    PrintFlowMonitorStats(monitor, flowHelper, port, rttMs, xmlFile, throughputMbps, lossRatio, avgDelayMs, meanJitterMs);

    g_summaryStream &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(6)
                    &amp;lt;&amp;lt; rttMs          &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt;
                    &amp;lt;&amp;lt; throughputMbps &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt;
                    &amp;lt;&amp;lt; lossRatio      &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt;
                    &amp;lt;&amp;lt; avgDelayMs     &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\t&quot;&lt;/span&gt;
                    &amp;lt;&amp;lt; meanJitterMs   &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;;
    g_summaryStream.flush();

    g_cwndStream.close();
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (anim)
    {
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;delete&lt;/span&gt; anim;
        anim = &lt;span style=&quot;color: #66d9ef;&quot;&gt;nullptr&lt;/span&gt;;
    }
    Simulator::Destroy();
}

&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;//  main&lt;/span&gt;
&lt;span style=&quot;color: #75715e;&quot;&gt;// =============================================================================&lt;/span&gt;
&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt;
&lt;span style=&quot;color: #a6e22e;&quot;&gt;main&lt;/span&gt;(&lt;span style=&quot;color: #66d9ef;&quot;&gt;int&lt;/span&gt; argc, &lt;span style=&quot;color: #66d9ef;&quot;&gt;char&lt;/span&gt;* argv[])
{
    std::vector&amp;lt;uint32_t&amp;gt; rttValues = {10, 25, 50, 75, 100, 125, 150, 175, 200};
    &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; std::string resultsDir = &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;scratch/results&quot;&lt;/span&gt;;

    ::mkdir(resultsDir.c_str(), 0755);

    &lt;span style=&quot;color: #66d9ef;&quot;&gt;const&lt;/span&gt; std::string summaryPath = resultsDir + &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/summary.dat&quot;&lt;/span&gt;;
    g_summaryStream.open(summaryPath);
    &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (!g_summaryStream.is_open())
    {
        std::cerr &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;ERROR: cannot open &quot;&lt;/span&gt; &amp;lt;&amp;lt; summaryPath &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n&quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Ensure scratch/results/ exists and is writable.\n&quot;&lt;/span&gt;;
        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 1;
    }

    g_summaryStream &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;# RTT_ms\tThroughput_Mbps\tLossRatio\tAvgDelay_ms\tMeanJitter_ms\n&quot;&lt;/span&gt;;

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╔══════════════════════════════════════════════════════════╗\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║          TCP Reno RTT Analysis  –  ns-3 v3.42            ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║                    ID: 24BPS1135                         ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╠══════════════════════════════════════════════════════════╣\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  Topology    n0 (BulkSend) ──[P2P 10 Mbps]── n1 (Sink) ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  TCP          TcpLinuxReno  (classic AIMD)               ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  MSS          &quot;&lt;/span&gt; &amp;lt;&amp;lt; std::setw(4) &amp;lt;&amp;lt; g_segmentSize &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; bytes                                   ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  Sim time    30 s per run                                ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  RTT values  10 25 50 75 100 125 150 175 200  ms         ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  Results     &quot;&lt;/span&gt; &amp;lt;&amp;lt; resultsDir &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;/                        ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╚══════════════════════════════════════════════════════════╝\n&quot;&lt;/span&gt;;

    &lt;span style=&quot;color: #f92672;&quot;&gt;for&lt;/span&gt; (std::size_t i = 0; i &amp;lt; rttValues.size(); ++i)
    {
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;const bool&lt;/span&gt; firstRun = (i == 0);
        RunSimulation(rttValues[i], firstRun, firstRun, resultsDir);
    }
    g_summaryStream.close();

    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;\n╔══════════════════════════════════════════════════════════════════════╗\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║                         FINAL RESULTS SUMMARY                        ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╠══════════════════════════════════════════════════════════════════════╣\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║ &quot;&lt;/span&gt;
              &amp;lt;&amp;lt; std::left  &amp;lt;&amp;lt; std::setw(9)  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;RTT(ms)&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; std::setw(18) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Throughput(Mbps)&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Loss Ratio&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; std::setw(15) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Avg Delay(ms)&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; std::setw(15) &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Jitter(ms)&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╠══════════════════════════════════════════════════════════════════════╣\n&quot;&lt;/span&gt;;

    std::ifstream fin(summaryPath);
    std::string line;
    &lt;span style=&quot;color: #f92672;&quot;&gt;while&lt;/span&gt; (std::getline(fin, line))
    {
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (line.empty() || line[0] == &lt;span style=&quot;color: #e6db74;&quot;&gt;&#39;#&#39;&lt;/span&gt;)
            &lt;span style=&quot;color: #f92672;&quot;&gt;continue&lt;/span&gt;;
        std::istringstream iss(line);
        uint32_t rtt;
        &lt;span style=&quot;color: #66d9ef;&quot;&gt;double&lt;/span&gt; tp, lr, ad, jt;
        &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (!(iss &amp;gt;&amp;gt; rtt &amp;gt;&amp;gt; tp &amp;gt;&amp;gt; lr &amp;gt;&amp;gt; ad &amp;gt;&amp;gt; jt))
            &lt;span style=&quot;color: #f92672;&quot;&gt;continue&lt;/span&gt;;
        std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║ &quot;&lt;/span&gt;
                  &amp;lt;&amp;lt; std::left  &amp;lt;&amp;lt; std::setw(9)  &amp;lt;&amp;lt; rtt
                  &amp;lt;&amp;lt; std::fixed &amp;lt;&amp;lt; std::setprecision(4)
                  &amp;lt;&amp;lt; std::setw(18) &amp;lt;&amp;lt; tp
                  &amp;lt;&amp;lt; std::setprecision(6)
                  &amp;lt;&amp;lt; std::setw(12) &amp;lt;&amp;lt; lr
                  &amp;lt;&amp;lt; std::setprecision(3)
                  &amp;lt;&amp;lt; std::setw(15) &amp;lt;&amp;lt; ad
                  &amp;lt;&amp;lt; std::setw(15) &amp;lt;&amp;lt; jt
                  &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot; ║\n&quot;&lt;/span&gt;;
    }
    std::cout &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╚══════════════════════════════════════════════════════════════════════╝\n\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╔══════════════════════════════════════════════════════════════════════╗\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║                         OUTPUT FILES                                 ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╠══════════════════════════════════════════════════════════════════════╣\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  summary.dat              RTT, Throughput, Loss, Delay, Jitter       ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  cwnd_rtt_Xms.dat          Congestion window trace  (9 files)        ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  flowmon_rtt_Xms.xml       FlowMonitor XML export   (9 files)        ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  tcp-reno-rtt-Xms.tr       ASCII link traces         (9 files)       ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  tcp-reno-rtt-0-0.pcap    Sender PCAP     (RTT=10ms, Wireshark)      ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  tcp-reno-rtt-0-1.pcap    Receiver PCAP  (RTT=10ms, Wireshark)      ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;║  tcp-reno-netanim.xml     NetAnim animation (RTT=10ms)               ║\n&quot;&lt;/span&gt;
              &amp;lt;&amp;lt; &lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;╠══════════════════════════════════════════════════════════════════════╣\n&quot;&lt;/span&gt;;

    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; 0;
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Output :&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Terminal Output 1&quot; height=&quot;283&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhhOiPEOfHAWoK6_bA_kVo6OfeDuznWUMrkJpBA6xtO2tUrJ2_9SsOA5aOLG4FK090qSkvnrDFmwUCQXcxupifwLwz4Tr8M1xGvup5GXufwVbPJUxJaDFyTJpCJ6YK7M-039phLjsMzJagesGKNV9mDmMG8NEMID3d5XNkx7E3g6jrNmstK0RgR8TNI-TA&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Terminal Output 2&quot; height=&quot;529&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhPEQ5-USMzYEsrjv8gQBo-DSLkb6PNYk0htz9SrOMJU9nF05V5c7iP5Au1r5Km5drNANCHPkWarF7sAklmeU3adB-Chdz51Hu8TxfuvPJEiDjlBrdi_T_sTXghdeGepk3f6rkLssAcl334LXk423NFfxDH7Sd1GS5FNeAraQ-FYod2gVqhm0zLLbov3w0&quot; width=&quot;655&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Terminal Output 3&quot; height=&quot;815&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgz-eKmTsCKRXOT_2HfD-pak007fBzU2iOwkdBAde8KyEJE8Dov2u07HelnUTC99Lide5HLo2u-y8ePDg0Qv24W2Lb8DOHu5VKlIXfxvIfhgR4rlb26mWUry5jHeYhQf1-uZIrBOWDTImTg_tcJzclV22sa3KeEF-CI4oPsjv9UYcuV9GcwIPlCXV2znCw&quot; width=&quot;524&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Terminal Output 4&quot; height=&quot;729&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiAu-tuijeIaq5gBS_46Bnyv1iKP4wS97Inse2bGWYrvnxvfX-g7bYYW04WjpHyIEVUOL5tlB0sQ647xcTcZb0ieHnT6ViKl_q4lI0DgDtXc3dRmBWC-x1j9k-FATAZ-aTRiQguvCgY5_J_hYpdO_5IZXE2ps8eo86i829871qLe2MUu25hrpB3I88LMGM&quot; width=&quot;455&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Terminal Output 5&quot; height=&quot;801&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiHYqxyqKwaC5NAk71sRNrMaGGoPCVKJeXhtV-lRcVLnhTf_Ws_pQABE7a_5US6zsQy-btZM1ks17PXVx9crKcvCZY3uvhTl-9BPqZif1hNof8NkbtKrbdohZEI3jaeQHfzpz9QBep6O-Vrfg7zsY07YU3A8FvCMTFKTHv0jGx_8nRq8e0bRn5a2jWiXYQ&quot; width=&quot;496&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Terminal Output 6&quot; height=&quot;599&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiYLIuDe2Bxoz4wwTOf_ZEwjCj_-mnV4ob1bRu9Qe2A-5jZ6u88WiIq5O2BXNst_X7LW4s_qaAJ1NzDi4OWD7n_T0zZJ2igBf5Vx6k0kIAWD8YXAeZKSkgpo9MzP7vc6RFyYc1G0hSZZFKPaFd00TZ4Z1qLC4PVbefIeT0Tn3gX3FKyKcLUirJI1IbiUic&quot; width=&quot;391&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Terminal Output 7&quot; height=&quot;444&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg-930Ijbf6vpGuefGbOCJvNGFxXzqJWxD-yk773O7mOUkZSMAaannlZqB7pvfS8VgFUKLDRqjx_kWg8l3LwDZo85vdzUHTW0N5qmp9tut1eYsgGeGk9ioSN5qYSwY4CLkcaloxC9FTvWToCeEREbnSfd7ClaPOdPT4f0q-zscf_13VBFOO3fccdTxNblE&quot; width=&quot;592&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;NetAnim:&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;NetAnim Visualization (tcp-reno-netanim.xml)&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
  NetAnim displays two nodes — n0 (Sender) on the left and n1 (Receiver) on the right — connected by a link, with animated dots representing packets flowing between them during the simulation. It provides a visual confirmation that data transmission is occurring correctly and that the TCP connection is active between the two endpoints.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;NetAnim Visualization 1&quot; height=&quot;405&quot; src=&quot;data:image/png;base64,R0lGODlhcQKVAXcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAABxApUBhwAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBmAABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNmZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZmzGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZAJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZZsyZmcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9mmf9mzP9m//+ZAP+ZM/+ZZv+Zmf+ZzP+Z///MAP/MM//MZv/Mmf/MzP/M////AP//M///Zv//mf//zP///wECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwj/AAMIHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnEmzps2bOHPq3Mmzp8+fQIMKHUq0qNGjSJMqXcq0qdOnUKNKnUq1qtWrWLNq3cq1q9evYMOKHUu2rNmzaNOqXcu2rdu3cOPKnUu3rt27ePPq3cu3r1++LAYGFjg4QOHDghMTVmyYMeLFkBtHfiy5MuXLjjNP1myZM+bNoDuH/iy6NOnTnhmDLEyQterXkVsfRD06de3bpm3nxk17t+/ewHUH5y28+ORW2JArT858ufPm0J9Lj059uvXq2K9rz859u/fu4L+L/w9Pfrz3U0vs1LETRb379e3Xy2f/3n37JaHMl9+vvz////4FCOCAAhZI4IEGLofNggw26OCDEEYo4YQUVmjhhRhmqOGGHHbo4YcXSmPHiCSWaOKJKJbIh4PIPdgiixi+2KCMINZo44045qjjjjz26OOPQAYp5JBEXngKievZAUqSI4Yy4hskQvlklFHmh+CVChap5ZZcdunll2CGKeaYWopoYitO8jGimiaqeaSKKjKInCB0tiJIc3e2kqWMrVxRp3J6CuJcni/SSOahiCaq6KKMNuookadowqQd0vARyimn8IFpK6dUiumnnfIRDZt2wGGlcoJcYaeqqabap57Y0f8pq6yqsupqrbBm+eiuvPbq66/ABotjKyZueqmmmNpxCijLorlsKH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CycwYX7LbXLRtZt9dueiFfMW9lbtBWH5h1hl3HEHbZW6f99dpjv31223fHnXfdewf+d+FzJ9734oM/fnjjl0eeeeWbh/556ZOn3vnqo79+elch+ptsvZGFnF3Ixye/fPPPRz999ddnv333+94PUXHnH5d+0+vHn3798+d/f//7B+D/BBhAAg7QgAVE4AEVmEAGLtCBDYTgAyUYQQpO0IIVxOAFNZhB/w5u0IP1WxSQmJQWE3XNhCM0EwlPqEIU1iaFL3RhDItUwhbOcIUwtGENGbVDGrLQhzjk4Q1lGEQd9hCIRhwiEnP4wyQKcYlHdCIRmfjEJhYxikqUIgx1hSsu3sqLtAKjrcLYxTF+UYxnJCMazZhGNq7RjWWEoxrj2MY5vlGOnRpTHvXYGCr2MYtVnOIf/YhFQl7RkFZEZCALmUgoMhKQjVTkISPpyEFKEpKXfGQmK0lJQXZykZMEpRb3OEpS9sWOdLwjKlV5SlbW0ZWpbCUsX7nKWcaSlrLE5S11aUseldKXvzQLJz+JyU2GUpOetOQxh6nMZBaTmMgUZjOhaUxnMjAzmtek5jSfucxqdrOTwARnOMnCy1qWM5fkPKc5d6lOdK4zne90ZzzbOU92ygobAQEAOw==&quot; width=&quot;625&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;NetAnim Visualization 2&quot; height=&quot;405&quot; src=&quot;data:image/png;base64,R0lGODlhcQKVAXcAMSH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACH5BAEAAAAALAAAAABxApUBhwAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBmAABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNmZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMAD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j059uvXq2K9rz859u/fu4L+L/w9Pfrz3U0vs1LETRb379e3Xy2f/3n37JaHMl9+vvz////4FCOCAAhZI4IEGLofNggw26OCDEEYo4YQUVmjhhRhmqOGGHHbo4YcXSmPHiCSWaOKJKJbIh4PIPdgiixi+2KCMINZo44045qjjjjz26OOPQAYp5JBEXngKievZAUqSI4Yy4hskQvlklFHmh+CVChap5ZZcdunll2CGKeaYWopoYitO8jGimiaqeaSKKjKInCB0tiJIc3e2kqWMrVxRp3J6CuJcni/SSOahiCaq6KKMNuookadowqQd0vARyimn8IFpK6dUiumnnfIRDZt2wGGlcoJcYaeqqabap57Y0f8pq6yqsupqrbBm+eiuvPbq66/ABotjKyZueqmmmNpxCijLorlsKHyg2SZzC+rpp6CtYntntXJW6+eqfibHgqDXakutsOimK2yh3XLr7rnsvhsvvO3SK2+98+aL77739mvvv/r6GzDA/BIscMEDJ1zwm5q8wawmmlqqKSjQhhJKNKdYfIopmZ4ipR1vnJpcn7PeSvJ1giZXrq104votdQfHbPDMCstcM80I52yzzjjv7HPPQN88r7pEF40osSkmbQepSa/obq4jVwv1vS3mWnXUesL6rtFcd+3lc9zuCV3Y9Iptdtlos3u22ml3u7bbbZPN9txw0y133XjfrTfMfIP/3ffYf7cCCpSEg2x44YgfrjjhIieIZdyBQ+735IBT/vbelkte+eaXR26353mDjjnnmnfut9eop/4jmpZSzAcorofiOuwVzx777KdgMwvPQvOu+u/A79j7z8MH7TvxxxuP/PLKN1/88wzSwuDuC0q/IPXYWK979NMnDz3z3zvv/fjgky9++eifr/7Awbfv/vvwxy9/h6aT/nnm99sfOv776z96/QAsnQDzF0ACDrB/BUTgAf+3QNE5kH8MNKAEFTjBCFLwghbM4AP9t0FDze+DIAyhCEfoq/CZ0HwnTF8K14fCFqrQhSx8oQxjSMMV2hCGN5xhDmtIwh768IdADGKQ/yDYwQYS8YgcRGICNahEGC2xiBWEIgal6AoxNTGKV5xiFslWRSYm8YtP3KIUvdi5CXnwjBCSURfR6KI0urGNc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NSRzWVVFVTZRVVV0+FddVXZY211VpnbXWyTFsRRBAj/cQyqV6xuZItg3rFsFBlDV22WWafdTZaaKeVtlpqr7U220M9jUiQK5C9MlxeeS22WGLDRbfcK68Y99txF/o2XnHdHShedotl7bsv99W339X4/ddfYwVmDuCBA0b4YIULJjjZhR1mOOGIHw52YoshxrjijG3k2OCLNQa544ZD9njjkkkeWWSJTU75ZJUpFrlJ2uS9omZ5va3ZW2+J/VZnm3OmGWhBWOj5CoVuHrpYpFnodVhsn9Y2aqj/p5a6aqqvtjprrLeelD6IksbZXZu9baVonsnVuemix+7VZl7vDXtdpuFdF2ecQcQ7b7335rtvv/8GPHDBBye8cMMPRzxxxRdnvHHHH897ounwjZfcni2veSCycwYX7LbXLRtZt9dueiFfMW9lbtBWH5h1hl3HEHbZW6f99dpjv31223fHnXfdewf+d+FzJ9734oM/fnjjl0eeeeWbh/556ZOn3vnqo79+elch+ptsvZGFnF3Ixye/fPPPRz999ddnv333+94PUXHnH5d+0+vHn3798+d/f//7B+D/BBhAAg7QgAVE4AEVmEAGLtCBDYTgAyUYQQpO0IIVxOAFNZhB/w5u0IP1WxSQmJQWE3XNhCM0EwlPqEIU1iaFL3RhDItUwhbOcIUwtGENGbVDGrLQhzjk4Q1lGEQd9hCIRhwiEnP4wyQKcYlHdCIRmfjEJhYxikqUIgx1hSsu3sqLtAKjrcLYxTF+UYxnJCMazZhGNq7RjWWEoxrj2MY5vlGOnRpTHvXYGCr2MYtVnOIf/YhFQl7RkFZEZCALmUgoMhKQjVTkISPpyEFKEpKXfGQmK0lJQXZykZMEpRb3OEpS9sWOdLwjKlV5SlbW0ZWpbCUsX7nKWcaSlrLE5S11aUseldKXvzQLJz+JyU2GUpOetOQxh6nMZBaTmMgUZjOhaUxnMjAzmtek5jSfucxqdrOTwARnOMnCy1qWM5fkPKc5d6lOdK4zne90ZzzbOU92ygobAQEAOw==&quot; width=&quot;625&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;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wECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwECAwj/AAMIHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnEmzps2bOHPq3Mmzp8+fQIMKHUq0qNGjSJMqXcq0qdOnUKNKnUq1qtWrWLNq3cq1q9evYMOKHUu2rNmzaNOqXcu2rdu3cOPKnUu3rt27ePPq3cu3r1++LAYGHiw4AGGBhAMjNsx48WHGjxMXjgx5cuPKijFbzizZ8eXOmj1zrix6s+nSqEOrBs2a9GrXrSmLHL249ufCtmnfLk25923fo4Gffi08dezfyIMnH35cuXPmsKMXJ77cuHTDrbBl3669O/fv3sOD/x8vvjz58+bTo1+vvj379+7jw58vvz7996eW2KljJ8r+//z5x9+A/QH4n39LhHKffQwu6GCDED4oYYQUTmhhhRheyB02HHbo4YcghijiiCSWaOKJKKao4oostujiizCiKI0dNNZo44045mgjHx9mB6KPPaYIpIdDxmjkkUgmqeSSTDbp5JNQRinllFRWieIpNfJnByha0hgKjW/UGCaYYoqpYIZobmjlmmy26eabcMYp55x0rjnjja18yQeNe964J5Y77thhdoIU2oog3iHaippDtnKFodstKsh3igJZZJ2YZqrpppx26umnVZ6iSZd2SMNHKKecwkeqrZxiaqqwuv/Kh6k1wnHmdoJccaiuuebq6KLpFSqssLry6muxwKoJ6rLMNuvss9BGm2QrN7KK6qqp2nEKKNvmuW0ofOTpZ3ccLvropL2ii2i5g5b76K6PasfCpOeqS660+OYrraXtsuvvvfz+GzDA/RIscMEDJ1zwm5q8wawmmlqqKSjQhhJKNKdYfIopmZ4ipR1vnJpcn7PeSvJ1giZXrq104votdQfHbPDMCstcM80I52yzzjjv7HPPQN88r7pEF40osSkmbQepSa/obq4jVwv1vS3mWnXUesL6rtFcd+3lc9zuCV3Y9Iptdtlos3u22ml3u7bbbZPN9txw0y133XjfrTfMfIP/3ffYf7cCCpSEg2x44Ygf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RhwiEnP4wyQKcYlHdCIRmfjEJhYxikqUIgx1hSsu3sqLtAKjrcLYxTF+UYxnJCMazZhGNq7RjWWEoxrj2MY5vlGOnRpTHvXYGCr2MYtVnOIf/YhFQl7RkFZEZCALmUgoMhKQjVTkISPpyEFKEpKXfGQmK0lJQXZykZMEpRb3OEpS9sWOdLwjKlV5SlbW0ZWpbCUsX7nKWcaSlrLE5S11aUseldKXvzQLJz+JyU2GUpOetOQxh6nMZBaTmMgUZjOhaUxnMjAzmtek5jSfucxqdrOTwARnOMnCy1qWM5fkPKc5d6lOdK4zne90ZzzbOU92ygobAQEAOw==&quot; width=&quot;625&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;Comparison Data File&lt;/h2&gt;
&lt;p&gt;This &lt;code&gt;.dat&lt;/code&gt; file is a referral file to plot the Gnuplot graphs:&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Comparison Data File Summary&quot; height=&quot;266&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiQO7qAoC3EOP2X-LiI582cFALalnPWTgxT7W9fv1xiXEdWdkgCmYscw7g7u-NfhrXhB8lo5VBYlxPgi8KKeQIXLO8fxVqChJvQacj3w9eNMph9PY-eZ3SWyBlehDygyU_wjyXVoAm-Y-oqBfJ-19FeJMa6PQ3qxBzYI8q7U2-rydLPkXdF-qmBGt7hd9Q&quot; width=&quot;516&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;Gnuplot Graphs&lt;/h2&gt;

&lt;h3&gt;RTT vs Packet Loss Graph (loss_vs_rtt.png)&lt;/h3&gt;
&lt;p&gt;
  This graph plots RTT against the packet loss ratio, showing a gradual upward trend as RTT increases. Higher RTT causes a larger Bandwidth-Delay Product, which overflows the fixed-size DropTail queue more easily, resulting in more frequent packet drops.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;RTT vs Packet Loss Graph 1&quot; height=&quot;362&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiM6u82eMeljgvY7cAcRhZkITtr4nLXE3MsKSJ-pekVBr33hOErZCcLShUMOLeYF-A2a96-AKoCKyAxZYWnN13a-6jyhoa7TiLcfkE3zh-mJIfDzLpHFDnokxW9TQhO46H417B_K8I2iFJqw8IDuUc4SGdYQKh1QVuUT4sUPP_VqZSOE3X-iamLaHTcIdM&quot; width=&quot;542&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;RTT vs Packet Loss Graph 2&quot; height=&quot;433&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEinip4CJYZEftz_byRkyywUVyXzQC7VGdktv0ARsTxe4kv19HYXxRcNDWQoGzrW4trVmpk1B05TPuiKurfVI0FQr6ojXTf4CGG-r08vjcyFuufPzkaBQKT-sKHWa_yOFKyTGnpotBcTBjQNIaPlEn_bA7aPXxoWrbEBHMOfcmEcIBwErAtx-18HH_75lt0&quot; width=&quot;625&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h3&gt;RTT vs Throughput Graph (throughput_vs_rtt.png)&lt;/h3&gt;
&lt;p&gt;
  This graph plots RTT (x-axis) against achieved throughput in Mbps (y-axis), showing a downward curve as RTT increases. It demonstrates that TCP Reno becomes progressively less efficient at higher RTTs because the congestion window grows slower when ACKs take longer to return.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;RTT vs Throughput Graph 1&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjvRRKjY-WGhfrZ3Wm8wJ5KU1krdIkLpVRm4sPg8ZbevlMYsTX0_uhzfgo3YKS4RZQm7XQputwRXhYwAzLst94DJ36ntxQcODD4V_p7jygO93LW41sDSiOwEr7F06t6SZh19OPMEmmq7PZSo97Qfe1dzmOVSFET4eg_HvaV6MgUxcyURHdWqFhD8gXZAzw&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;RTT vs Throughput Graph 2&quot; height=&quot;447&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjY50Y7eYlSkjdTemC3emZIUgV0AFB8ZHnLrfl4Vq1RsugkgFTlBCP_cEdLxXlGo1qcbd9izNDQb042RoquL7LYz5-ofoj2-YuRQ7bEthEPQPQvw5e9l3gW3og1lMJmuPRYHIxgPutvtofFq6x3OBZajJEnXTXR3mANFlmNHQ4ObpD2iePLjQAOp-ta9ZA&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h3&gt;Congestion Window over Time Graph (cwnd_over_time.png)&lt;/h3&gt;
&lt;p&gt;
  At lower RTT the window climbs steeply and reaches a high steady state, while at higher RTT the growth is gradual and resets happen more frequently, keeping cwnd chronically low.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Cwnd over Time Graph 1&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjte45_Z2RNIcs96Wf8SC0L4tZKxSqW1_vd59umOSV7PhsVSQXJ8eDlAqWQEB34wDXtasiB4wa3RCnv6kpbcvO6fyZ4JcXlTaWlTzH7PlCxmbVOgD_ESRnhU4Fm0UdBc9BTN-K8I3ZUQNYFTQaOtc5x0bcVW4dZahGlqzO0pb_AgObBBuTqA0om4gLx2ns&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;Cwnd over Time Graph 2&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhrrxItkJmFXV2rW39cYgR2lqquEQ8uL5pYFKPpzyCMVYtQj6_2G61MddnHs5DzhXulV4kVQJbNF3N-hL6QFNHEYtKeT2QAxJX1LlypyuSyt5G1fI6MxWOex_2ZGVjeR9C7KyM8SGqS_8FPIIp2pXZ48q3str_C1GBbbDre5SqGeZMYXYqSW70-wLYKqTQ&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;TraceMetrics Result for 10, 100 and 200 ms, Respectively&lt;/h2&gt;
&lt;p&gt;
  The trace metrics comparison illustrates that increasing RTT leads to reduced throughput, higher packet loss, and increased end-to-end delay due to slower congestion window growth and higher Bandwidth-Delay Product in TCP Reno.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;TraceMetrics 10ms&quot; height=&quot;352&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjYlD-uddtqixw6n9LaWkeKE_lj6h4xY9J_oD9Oy5nPfBQE2j-9eo48Qm-Gq-pKcrkeSR22qPZTiG6moSgy51sT-Rbr44K8Nu1TtkM1dOkyr3FusVxSdFeF-DA2FK1DXi2RE4-NTjKRbB2M8paHIbTk_Z2gEUoM5-iSwzX7NQZWy3OztAni79RSQX22sbE&quot; width=&quot;549&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;TraceMetrics 100ms&quot; height=&quot;397&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhqGLEXs768-ziaVp1ygndYLcJwb-MpwcHyGQTscJD2fU49K72Tn8BFEA6vX2A-7B_m1j6VLBXiXJF2xjadBinkSGrbuMKB7UQ4rL3QLOvDoqORGrSeJrkDmXsBLuUsDfkdssM404aNaTp5UBUbFOLorN1jU41JbKEJ8yjBLPXEtrQLuh1ifOVm7EjfKpY&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto; margin-bottom: 12px;&quot; /&gt;
  &lt;img alt=&quot;TraceMetrics 200ms&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhjDq4UT6mapHcPmRAdYEZD1DJmwFC3nvzkRI6aoxqyWWj8BY3Uf83jxAgMv7kZJ_DaycEFdqIS5XSG5DQzJ7U3A1gQCkbBdYeNZioMWX4KKeX8UbaxCQPH94jnjJ9I9LSxqAXNosDP_kVJnVszTSC0sK-Dg-xJCMeEOgbwrF1Fxq6einbUmiL_BbnbF90&quot; width=&quot;624&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;h2&gt;Wireshark Analysis&lt;/h2&gt;
&lt;p&gt;
  The image below shows the TCP three-way handshake (SYN, SYN-ACK, ACK) followed by continuous data transmission between 10.1.1.1 (sender) and 10.1.1.2 (receiver), confirming successful connection establishment and active TCP Reno data flow.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark Handshake Trace&quot; height=&quot;405&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi0QPr6FrwgD1Ykk-x8cIX0xiCrk4TGFChCcslXj2ze6dfTV5PoCHqRRZ4F1R82dzbbkZh_KOPMQW_FG8eSUuTJAcNwKBBr1aK__OYxBE1qcX9Mi5SDWOrPti7bCj5AXqeGNi6S8C553JFKfMeaU3masJal7G5DXIjcTOmjTR2uVyJfqiJ5HGujfb4zRM0&quot; width=&quot;625&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The image below displays Wireshark’s Expert Information, highlighting events such as duplicate ACKs, retransmissions, and out-of-order packets, which indicate congestion and TCP Reno’s loss recovery mechanisms.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark Expert Information&quot; height=&quot;629&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj_ubrkZkc_S-1pgpvOCnCEKTGhpPXYNJWg36krBk6CvEuPMN2ec3JE09pDamKA-VkNFDr_yxQM_OExjqNVCyhXVI6MQa_iWoL6TK74WYmPhMcTbiRyy3Y06_tM5035qWCyLd5nZH2TIl8l7NPW6pDxtoG6UlpEBCx6GtO-gzLFWR-Pzc367r5qGXAFVQk&quot; width=&quot;623&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;
  The graph below shows packet flow over time along with TCP errors, illustrating fluctuations in transmission rate and the occurrence of congestion-related issues such as retransmissions during the simulation.
&lt;/p&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center; margin: 1.5em 0;&quot;&gt;
  &lt;img alt=&quot;Wireshark I/O Graph&quot; height=&quot;405&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi3dUygE8lwOp7rYmpjjmqKT8ngDK-YcUG1CFUWSNsg3aqxfiVsM0ehGDUJshnm9OvTv5fAM3oe81HbdiPr3FzQ2bEmSYe4P3KdooXiy7m6g0Qy8gadl-x3zj0sClLhuRatpuB1xhIM6bIqz7OQLkni5nV4Z38STLgV9svoAj83E99ounuOZpoHrgUgExE&quot; width=&quot;625&quot; style=&quot;max-width: 100%; height: auto;&quot; /&gt;
&lt;/div&gt;

&lt;script async=&quot;&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-6266661353943337&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;6306553473&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
  (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;div class=&quot;g-ytsubscribe&quot; data-channel=&quot;tspradeepkumar&quot; data-count=&quot;default&quot; data-layout=&quot;full&quot; data-theme=&quot;dark&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!-- linuxasaservice_main_AdSense1_728x90_as --&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:728px;height:90px&quot;
     data-ad-client=&quot;ca-pub-6266661353943337&quot;
     data-ad-slot=&quot;9847222411&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.nsnam.com/feeds/5955565487103046694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.nsnam.com/2026/06/performance-analysis-of-tcp-reno.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5955565487103046694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8826608353769320919/posts/default/5955565487103046694'/><link rel='alternate' type='text/html' href='http://www.nsnam.com/2026/06/performance-analysis-of-tcp-reno.html' title='Performance Analysis of TCP Reno Congestion Control Under Varying Round-Trip Time Conditions | NS3 Project 14'/><author><name>T S Pradeep Kumar</name><uri>http://www.blogger.com/profile/00230848934745389790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxHG4eBViGmCuaEhrkbDLv12NpIxi7_ebSrH-ebtXpvDWyEabaoNVCh4OVZnnUlOqTurglGCaIOuFwA-_rz5OAqQl3rAf3Goj-NrPCoBZVtzqNnd4Wp4hCqJ8j4HpuqYA/s113/IMG_0794.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhhOiPEOfHAWoK6_bA_kVo6OfeDuznWUMrkJpBA6xtO2tUrJ2_9SsOA5aOLG4FK090qSkvnrDFmwUCQXcxupifwLwz4Tr8M1xGvup5GXufwVbPJUxJaDFyTJpCJ6YK7M-039phLjsMzJagesGKNV9mDmMG8NEMID3d5XNkx7E3g6jrNmstK0RgR8TNI-TA=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry></feed>