简体   繁体   English

NS3 C ++ UdpEchoClientApplication错误

[英]NS3 C++ UdpEchoClientApplication error

I currently have 9 nodes and I want two of them to be a server. 我目前有9个节点,我希望其中两个成为服务器。 This is the code I currently have: 这是我目前拥有的代码:

Applicationcontainer serverApps =echoServer.Install (nodes.Get (3), nodes.Get (4));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));

When I try to compile it, it gives me the error 当我尝试编译它时,它给了我错误

Build failed
-> task in 'harry24' failed (exit status 1): 
{task 48837520: cxx harry24.cc -> harry24.cc.5.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/atk-1.0', '-I/usr/include/cairo', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/pango-1.0', '-I/usr/include/gio-unix-2.0', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/pixman-1', '-I/usr/include/freetype2', '-I/usr/include/libpng12', '-I/usr/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../scratch/harry24.cc', '-c', '-o', 'scratch/harry24.cc.5.o']

You should place these two nodes inside a NodeContainer and then call echoServer.install on the container. 您应该将这两个节点放在NodeContainer ,然后在容器上调用echoServer.install

NodeContainer nc;
nc.Add(nodes.Get (3));
nc.Add(nodes.Get (4));

Applicationcontainer serverApps =echoServer.Install (nc);
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));

The available install method overloads in udp-echo-helper.h . 可用的安装方法在udp-echo-helper.h中重载。

   /**
   * Create a UdpEchoServerApplication on the specified Node.
   *
   * \param node The node on which to create the Application.  The node is
   *             specified by a Ptr<Node>.
   *
   * \returns An ApplicationContainer holding the Application created,
   */
  ApplicationContainer Install (Ptr<Node> node) const;

  /**
   * Create a UdpEchoServerApplication on specified node
   *
   * \param nodeName The node on which to create the application.  The node
   *                 is specified by a node name previously registered with
   *                 the Object Name Service.
   *
   * \returns An ApplicationContainer holding the Application created.
   */
  ApplicationContainer Install (std::string nodeName) const;

  /**
   * \param c The nodes on which to create the Applications.  The nodes
   *          are specified by a NodeContainer.
   *
   * Create one udp echo server application on each of the Nodes in the
   * NodeContainer.
   *
   * \returns The applications created, one Application per Node in the 
   *          NodeContainer.
   */
  ApplicationContainer Install (NodeContainer c) const;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM