作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前有 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/
我目前有 9 个节点,我希望其中两个成为服务器。这是我目前拥有的代码: Applicationcontainer serverApps =echoServer.Install (nodes.Get (
我是一名优秀的程序员,十分优秀!