class Tools {static void run(F f, int & fail_flow) {vector <int> path;findPath(f, path);//--------------install routes//get server ip addressIpv4Address dest;int lid1 = path[path.size()-2];int lid2 = path[path.size()-1];if (interfaces.count(ii(lid1, lid2))) {dest = interfaces[ii(lid1, lid2)].GetAddress(1);} else {dest = interfaces[ii(lid2, lid1)].GetAddress(0);}.......................................................
//-----------client start to send packets
Address remoteAddress (InetSocketAddress (dest, 5000));OnOffHelper clientHelper ("ns3::UdpSocketFactory", remoteAddress);// clientHelper.SetAttribute ("OnTime", StringValue ("ns3::ExponentialRandomVariable[Mean=2]"));// clientHelper.SetAttribute ("OffTime", StringValue ("ns3::ExponentialRandomVariable[Mean=0.5]"));
clientHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
clientHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));clientHelper.SetAttribute("Flowid", UintegerValue(f.fid));cout << "Onoff send at node " << nodes.Get(path[0])->GetId() << endl;cout << "Onoff end at node " << dest << endl;ApplicationContainer apps = clientHelper.Install (nodes.Get(path[0]));apps.Start (Simulator::Now()); /* delay startup depending on node number */apps.Stop (Seconds (cOffT));cout <<"Flow " << f.fid << " start " <<Simulator::Now() <<endl;path.clear();}};int main() {
int flow_id = 0;//each host send to other host randomlyint head = (1-pow(branch, level-1))/(1-branch);for(int i = head; i <= 52; i++) {int dst = 0;dst = getRandom(i);F f(i, dst, flow_id);flow_id++;cout << "src " << i << " dst " << dst <<endl;Tools::run(f, fail_flow);// Simulator::Schedule(Seconds(cOnT), &Tools::run, f, fail_flow);}
}
apps.Start (Simulator::Now()); /* delay startup depending on node number */
--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/zfw3Yc5mU8E/unsubscribe.
To unsubscribe from this group and all its topics, 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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.