gpt4 book ai didi

java - NS3 C++ UdpEchoClientApplication 错误

转载 作者:行者123 更新时间:2023-11-28 06:18:28 25 4
gpt4 key购买 nike

我目前有 9 个节点,我希望其中两个成为服务器。这是我目前拥有的代码:

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

当我尝试编译它时,它给了我错误

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']

最佳答案

您应该将这两个节点放在 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));

可用的安装方法重载在 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;

关于java - NS3 C++ UdpEchoClientApplication 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29782238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com