Hi,
I would like to setup a network with N nodes, where node 0 has N-1 point to point connections (one for every other node). I also want to be able to send through each of these s connections some packets from my own protocol.
Basically, this is for testing purpose. I'm setting up a multicast transport protocol over IP, and I ant to be able to control link delay and error rate precisely on each link and independently from one link to another. The original simulation uses a wireless network, a broadcast IP and a XCAST header embedded in my IP header. It works fine but I can't control delay and error rates as I want.
here is the code to set those links on each nodes, where rand_src is my source (hence 0) and numNodes the amount of nodes I want.
NodeContainer node_container;
InternetStackHelper internet;
node_container.Create(numNodes);
p2p.SetDeviceAttribute("DataRate", StringValue(LinkRate));
p2p.SetChannelAttribute("Delay", TimeValue(MilliSeconds(LinkDelay)));
internet.Install(node_container);
Ipv4AddressHelper ipv4_n;
ipv4_n.SetBase("10.1.1.0", "255.255.255.0", "0.0.0.1");
for (uint32_t i = 0; i < node_container.GetN(); i++)
NodeContainer n_links = NodeContainer(node_container.Get(rand_src), node_container.Get(i));
NetDeviceContainer n_devs = p2p.Install(n_links);
Ptr<ErrorModel> em = CreateObjectWithAttributes<RateErrorModel > (
StringValue("ERROR_UNIT_PACKET"),
DynamicCast<PointToPointNetDevice>(n_devs.Get(0))->SetReceiveErrorModel(PointerValue(em));
DynamicCast<PointToPointNetDevice>(n_devs.Get(1))->SetReceiveErrorModel(PointerValue(em));
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
From where the log stands, each node has 1 IP, except node 0 which has N-1 IP. Each link is also in a separate network, and that's fine by me.
But when it comes to the sending process, I'm having some trouble.
Instead of the IP broadcast, I have to send the same packet to each destination. Let's say my flow has 3 receivers. In my wireless simulation, I send through one socket with a broadcast IP adress , and my XCAST header contains the 3 receivers. Each node in the network receives every packet, and treat them if they're in the XCAST header.
In my wired simulation, when I try to send the same packet with unicast IP source/destination (the right ones) AT THE SAME TIME through ONE IP raw socket, it doesn't work. It sends 1 packet to 0 or 1 receivers then crashes (Socket::Send() returns a value < 0)
I guess the socket is not ready to send another packet when I say so.
I did try with one socket for each point to point link at the sender side, but it still doesn't work. The exact same thing happens. Thus I think I don't need multiple sockets. Am I right?
IP adresses binding should be done by Ipv4AddressHelper::Assign(NetDeviceContainer) so ...
Am I missing something ? Some routing maybe?
Thanks in advance,
Mathias