OnOffApplication Packet Sink not working

109 views
Skip to first unread message

Trail Error

unread,
Jun 20, 2019, 11:51:49 PM6/20/19
to ns-3-users
I am trying to generate traffic at one node using on-off application and receive it at another node. But, the flow monitor says, the same node is transmitting and receiving the data. Where did I go wrong? The following is my code snippet:

uint16_t port = 29;   // Discard port (RFC 863)
   
Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210));
   
Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue ("448kb/s"));
   
Config::SetDefault ("ns3::OnOffApplication::OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.1]"));
   
Config::SetDefault ("ns3::OnOffApplication::OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.3]"));

 
OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (enbInterfaces.GetAddress (0,0), port)));
   
ApplicationContainer apps = onoff.Install (enbNode.Get (0));
    apps
.Start (Seconds (0.0));
    apps
.Stop (Seconds (10.0));
   
   
// Create a packet sink to receive these packets
  uint16_t sinkPort
= 19;
 
// Address m_sinkAddress (InetSocketAddress (ueInterfaces.GetAddress (0), sinkPort));
   
PacketSinkHelper sink ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address::GetAny (), sinkPort))); //Ipv4Address::GetAny () //ueInterfaces.GetAddress(0)
   
ApplicationContainer appSink = sink.Install (ueNode.Get (0));
    appSink
.Start (Seconds (0.0));
  appSink
.Stop (Seconds (10.0));

Flow Monitor gives this:
Flow 2 (10.1.3.4 -> 10.1.3.4)
 
Tx Bytes:   158508
 
Rx Bytes:   158508
 
Throughput: 0.120932 Mbps


I have attached my full file also.
lte_wifi_v5.cc

Muhammad Talha Jahangir

unread,
Jun 21, 2019, 3:05:56 PM6/21/19
to ns-3-...@googlegroups.com
U install onoff application and sink application on same node

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/17a6d285-26a8-471e-8519-bdb93a49bdd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages