Hi Tommaso,
Thanks for your reply. According to your suggestion I revisited manual section of random variables. However, I could not able to generate random packet size through OnOff Application. My code is as follows:
Ptr<DeterministicRandomVariable> s = CreateObject <DeterministicRandomVariable> ();
double array [] = {64,128,256,512};
uint64_t count = 4;
s-> SetValueArray (array, count);
double value = s-> GetInteger();
Ipv4Address SN7_Address (subnet7Interfaces.GetAddress(1));
uint16_t SN7_port = 8080;
InetSocketAddress SN7_Socket_Address (SN7_Address, SN7_port);
OnOffHelper SN7_OnOff("ns3::UdpSocketFactory", SN7_Socket_Address);
Ptr <Packet> p67 = Create <Packet> (value);
std::cout<<"Packet Size of external Network: "<< p67->GetSize() <<std::endl;
SN7_OnOff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=5]"));
SN7_OnOff.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=10]"));
SN7_OnOff.SetAttribute("DataRate", StringValue("1Mbps"));
SN5_OnOff.SetAttribute("PacketSize", UintegerValue(p67->GetSize()));
ApplicationContainer SN7_OnOff_App = SN7_OnOff.Install(host.Get(0));
SN7_OnOff_App.Start(Seconds(0.0));
SN7_OnOff_App.Stop(Seconds(50.0));
PacketSinkHelper SN7_Sink("ns3::UdpSocketFactory", SN5_Socket_Address);
ApplicationContainer SN7_Sink_App = SN7_Sink.Install(routers.Get(1));
SN7_Sink_App.Start(Seconds(0.0));
SN7_Sink_App.Stop(Seconds(50.0));
Simulator::Stop (Seconds (50));
Simulator::Run ();
Could you please tell me where I did mistake. This code generates only initial value of packet size (512 bytes). I would like to make the packet size random. I will really appreciate your help.
Thanks.