Broadcast without port and Internet Protocol

46 views
Skip to first unread message

Masood Abbasi

unread,
Dec 19, 2018, 2:47:12 AM12/19/18
to ns-3-users
Hi,
I am running code that broadcasts packets but port is not specified and it works as data is received at other nodes. For Getting Rx trace from application layer i tried to use PacketSinkHelper but it needs port number besides address and Internet protocol needs to be installed.

This is broadcast sender working code snippet with no port specified and no Internet protocol. how can i capture packets Rx traces at application layer, what helper i need to install and what port number?
// Add packet socket handlers
        ns3::PacketSocketHelper packetSocket;
        packetSocket.Install(m_nodes);

        // Configure packet socket: use broadcasts
        ns3::PacketSocketAddress socket;
        socket.SetAllDevices();
        socket.SetPhysicalAddress(ns3::Mac48Address::GetBroadcast());
        socket.SetProtocol(1);

        ns3::OnOffHelper onOff ("ns3::PacketSocketFactory", ns3::Address (socket));
        onOff.SetAttribute ("PacketSize", ns3::UintegerValue (400 - GetProtocolOverheads()));
        onOff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
        onOff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
        onOff.SetAttribute ("DataRate", ns3::DataRateValue (ns3::DataRate ("128kb/s")));  //  MA "40kb/s"

        ns3::ApplicationContainer app;
        app = onOff.Install (m_nodes);
        app.Start(ns3::Seconds (0.0));
        app.Stop(ns3::Seconds (SimTime));  //20.0

Mas

unread,
Dec 20, 2018, 7:01:51 AM12/20/18
to ns-3-users
I did it. PacketSink working now

Amira Bezzina

unread,
May 13, 2019, 9:36:07 AM5/13/19
to ns-3-users
Hello,
Can you tell us what was the problem please.

Thanks
Reply all
Reply to author
Forward
0 new messages