- char* addr = IPV4addr.at(node2);
-
- XBT_DEBUG("ns3_create_flow %d Bytes from %d to %d with Interface %s",TotalBytes, node1, node2,addr);
- ns3::PacketSinkHelper sink("ns3::TcpSocketFactory", ns3::InetSocketAddress (ns3::Ipv4Address::GetAny(), port_number));
- sink.Install (dst_node);
-
- ns3::Ptr<ns3::Socket> sock = ns3::Socket::CreateSocket (src_node, ns3::TcpSocketFactory::GetTypeId());
-
- xbt_dict_set(flowFromSock, transformSocketPtr(sock), new SgFlow(TotalBytes, action), nullptr);
-
- sock->Bind(ns3::InetSocketAddress(port_number));
- XBT_DEBUG("Create flow starting to %fs + %fs = %fs",
- startTime-ns3::Simulator::Now().GetSeconds(), ns3::Simulator::Now().GetSeconds(), startTime);
-
- ns3::Simulator::Schedule (ns3::Seconds(startTime-ns3::Simulator::Now().GetSeconds()),
- &StartFlow, sock, addr, port_number);
-
- port_number++;
- xbt_assert(port_number <= 65000, "Too many connections! Port number is saturated.");
-}
-
-// initialize the NS3 interface and environment
-void ns3_initialize(const char* TcpProtocol){
-// tcpModel are:
-// "ns3::TcpNewReno"
-// "ns3::TcpReno"
-// "ns3::TcpTahoe"
-
- ns3::Config::SetDefault ("ns3::TcpSocket::SegmentSize", ns3::UintegerValue (1024)); // 1024-byte packet for easier reading