I have a scenario where wireless nodes send packets to a server (the server is also a wireless node) and this server broadcasts a packet to all nodes. I added the following code in the handleRead void in udp-server.cc
Ptr<Packet> p = Create<Packet> (1024); TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); Ptr<Socket> socket1 = Socket::CreateSocket (GetNode (), tid); socket1->SetAllowBroadcast (true); Ipv4Address address=Ipv4Address("10.1.3.255"); socket1->Connect (InetSocketAddress (address, port)); socket1->Send(p);
The server receives the packets from senders. But, packets are not sent by the server. I want to know if it is possible to enable broadcast in ns3 in wifi scenarios or if it is possible to enable multicast.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…