+
+ // If there is no other started actions, we need to move NS-3 forward to be sync with SimGrid
+ if (model->get_started_action_set()->size()==1){
+ while(double_positive(surf_get_clock() - ns3::Simulator::Now().GetSeconds(), sg_surf_precision)){
+ XBT_DEBUG("Synchronizing NS-3 (time %f) with SimGrid (time %f)", ns3::Simulator::Now().GetSeconds(), surf_get_clock());
+ ns3_simulator(surf_get_clock() - ns3::Simulator::Now().GetSeconds());
+ }
+ }
+
+ XBT_DEBUG("Communicate from %s to %s", src->get_cname(), dst->get_cname());
+
+ static int port_number = 1025; // Port number is limited from 1025 to 65 000
+
+ unsigned int node1 = src->get_netpoint()->extension<NetPointNs3>()->node_num;
+ unsigned int node2 = dst->get_netpoint()->extension<NetPointNs3>()->node_num;
+
+ ns3::Ptr<ns3::Node> src_node = src->get_netpoint()->extension<NetPointNs3>()->ns3_node_;
+ ns3::Ptr<ns3::Node> dst_node = dst->get_netpoint()->extension<NetPointNs3>()->ns3_node_;
+
+ xbt_assert(node2 < IPV4addr.size(), "Element %s is unknown to ns-3. Is it connected to any one-hop link?",
+ dst->get_netpoint()->get_cname());
+ std::string& addr = IPV4addr[node2];
+ xbt_assert(not addr.empty(), "Element %s is unknown to ns-3. Is it connected to any one-hop link?",
+ dst->get_netpoint()->get_cname());
+
+ XBT_DEBUG("ns3: Create flow of %.0f Bytes from %u to %u with Interface %s", totalBytes, node1, node2, addr.c_str());
+ ns3::PacketSinkHelper sink("ns3::TcpSocketFactory", ns3::InetSocketAddress(ns3::Ipv4Address::GetAny(), port_number));
+ ns3::ApplicationContainer apps = sink.Install(dst_node);