仅供下次看着方便
#include <sstream>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h"
#include "ns3/internet-module.h"
#include "ns3/yans-wifi-helper.h"
using namespace ns3;
using namespace std;
NS_LOG_COMPONENT_DEFINE ("DsrTest");
//回调函数
static void recvCallback(Ptr<Socket> sock)
{
Ptr<Packet> packet = sock->Recv();
cout << "size:" << packet->GetSize() << endl;
}
void send(Ptr<Socket> sock)
{
sock->Send(Create<Packet>(500));
}
int
main (int argc, char *argv[])
{
LogComponentEnable("DsrTest",LOG_LEVEL_ALL);
NS_LOG_INFO ("creating the nodes");
// General parameters
uint32_t nWifis = 5;
double TotalTime = 10.0;
double txpDistance = 100.0;
std::str