{"id":80,"date":"2016-03-07T05:04:39","date_gmt":"2016-03-06T21:04:39","guid":{"rendered":"http:\/\/windywind.tk\/?p=80"},"modified":"2021-01-22T08:32:54","modified_gmt":"2021-01-22T00:32:54","slug":"%e9%83%a8%e7%bd%b2ns-2","status":"publish","type":"post","link":"https:\/\/windywind.tk\/?p=80","title":{"rendered":"\u90e8\u7f72ns-2"},"content":{"rendered":"<p>ns-2\u662fUSC\u548c\u5176\u4ed6\u51e0\u4e2a\u673a\u6784\u5f00\u53d1\u7684\uff0c\u76ee\u524d\u7531\u00a0USC\/Information Sciences Institute\u7ef4\u62a4\u3002\u662f\u4e00\u6b3e\u57fa\u4e8elinux\u5e73\u53f0\u7684\u79bb\u6563\u4e8b\u4ef6\u7f51\u7edc\u6a21\u62df\u5668\u3002<\/p>\n<p>ns-2\u4e3b\u9875<em>http:\/\/www.isi.edu\/nsnam\/ns\/<\/em><\/p>\n<p>ns-2 Tutorial\u00a0<em>http:\/\/www.isi.edu\/nsnam\/ns\/tutorial\/ns.html<\/em><\/p>\n<p>ns-2\u7531\u8bb8\u591a\u90e8\u4ef6\u7ec4\u6210\uff0c\u6240\u4ee5\u4e0b\u8f7dall-in-one\u5305\u5b89\u88c5\u4f1a\u6bd4\u8f83\u7b80\u5355\u3002<\/p>\n<p>\u4ee5ns-2.35\u4e3a\u4f8b\uff0c\u7406\u8bba\u4e0a\u4e0b\u8f7d\u89e3\u538b\u540e\u8fd0\u884c\u5176\u4e2d\u7684\u53ef\u6267\u884c\u6587\u4ef6install\u5373\u53ef\uff0c\u4f46\u662f\u5728\u8fd0\u884c\u4e4b\u524d\u6211\u4eec\u8fd8\u6709\u5de5\u4f5c\u8981\u505a\u3002<\/p>\n<p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fUbuntu\u7b49Debian\u7cfb\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u90a3\u4e48\u5f88\u7b80\u5355\uff1a<\/p>\n<p>sudo apt-get update<br \/>\nsudo apt-get install build-essential autoconf automake libxmu-dev<\/p>\n<p>\u6267\u884c\u4ee5\u4e0a\u4e24\u6761\u547d\u4ee4\u4e4b\u540e\uff0c\u5c31\u5df2\u7ecf\u5b8c\u6210\u4e86\u4f9d\u8d56\u5305\u7684\u5b89\u88c5\uff08\u5751\u7239\u7684ns-2\uff0c\u4e3a\u6bdb\u8001\u5b50\u6ca1\u770b\u5230\u4efb\u4f55\u5173\u4e8e\u4f9d\u8d56\u5173\u7cfb\u7684\u8bf4\u660e\uff09<\/p>\n<p>\u5982\u679c\u4f60\u7528\u7684\u662fCentOS\u6216\u8005Fedora\u4e4b\u7c7b\u7684RedHat\u7cfb\uff0c\u90a3\u4e48\u4e0b\u9762\u51e0\u4e2a\u5305\u6211\u4e5f\u4e0d\u77e5\u9053\u54ea\u51e0\u4e2a\u662f\u5fc5\u987b\u7684\uff0c\u54ea\u51e0\u4e2a\u662f\u4e0d\u5fc5\u8981\u7684\uff0c\u53cd\u6b63\u6211\u90fd\u88c5\u4e86\uff08\u54e6\uff0c\u4f60\u81f3\u5c11\u9700\u8981gcc-c++\u8fd9\u4e2a\u5305\u548clibX11-devel, libXmu-devel\uff1a<\/p>\n<p>\u6709\u4eba\u53ea\u88c5\u4e86\u8fd9\u51e0\u4e2a\u5305<\/p>\n<p>libX11-devel*<br \/>\nxorg-x11-proto-devel*<br \/>\nlibXt-devel*<br \/>\nlibXmu-devel*<\/p>\n<p>\u4e5f\u6709\u4eba\u88c5\u4e86\u4e00\u5927\u5806<\/p>\n<p>yum install tkinter python-imaging python-tools libXmu-devel* libXt-devel* xorg-x11-proto-devel* libX11-devel* \u00a0<wbr \/>gcc-c++<\/p>\n<p>233333<\/p>\n<p>\u53cd\u6b63\u8fd9\u4e9b\u5305\u5f88\u591a\u90fd\u4e92\u76f8\u4f9d\u8d56\uff0c\u591a\u88c5\u4e5f\u6ca1\u4e8b\uff0c\u5c11\u88c5\u4e86\u5982\u679c\u7f16\u8bd1\u4e0d\u4e86\u3001\u8fd0\u884c\u4e0d\u4e86\u4f60\u4e5f\u4f1a\u77e5\u9053\u7684\u3002<\/p>\n<p>\u88c5\u5b8c\u4f9d\u8d56\u5305\u8fd8\u662f\u4e0d\u80fd\u88c5\uff0c\u7f16\u8bd1\u8fd8\u662f\u4f1a\u6709\u95ee\u9898\uff0c\u6709\u4e2a\u5730\u65b9\u8981\u5c0f\u6539\u4e0b\uff1a<\/p>\n<p>ns-2.35\/linkstate\/ls.h\uff0c\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u627e\u5230<\/p>\n<p>void eraseAll() { erase(baseMap::begin(), baseMap::end()); }<br \/>\nT* findPtr(Key key) {<br \/>\niterator it = baseMap::find(key);<br \/>\nreturn (it == baseMap::end()) ? (T *)NULL : &amp;((*it).second);<br \/>\n}<\/p>\n<p>\u5c06\u5b83\u4fee\u6539\u4e3a<\/p>\n<p>void eraseAll() { this-&gt;erase(baseMap::begin(), baseMap::end()); }<br \/>\nT* findPtr(Key key) {<br \/>\niterator it = baseMap::find(key);<br \/>\nreturn (it == baseMap::end()) ? (T *)NULL : &amp;((*it).second);<br \/>\n}<\/p>\n<p>\u641c\u7d22erase(baseMap\u4f1a\u5feb\u4e00\u4e9b\uff0c\u53ea\u8981\u5c06erase\u6539\u6210this-&gt;erase\u5c31\u884c<\/p>\n<p>\u7136\u540e\u9000\u5230ns-2.35-allinone\u76ee\u5f55\uff0c\u6267\u884c.\/install \u5c31\u53ef\u4ee5\u4e86\uff0c\u7f16\u8bd1\u5b89\u88c5\u4f1a\u6709\u4e00\u4f1a\u513f\uff0c\u4f46\u4e5f\u4e0d\u7b97\u5f88\u957f\u3002<\/p>\n<p><a href=\"https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-04-40-22.png\" rel=\"attachment wp-att-81\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-81\" src=\"https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-04-40-22.png\" alt=\"Screenshot from 2016-03-07 04-40-22\" width=\"749\" height=\"512\" srcset=\"https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-04-40-22.png 749w, https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-04-40-22-300x205.png 300w\" sizes=\"(max-width: 749px) 100vw, 749px\" \/><\/a><\/p>\n<p>\u5982\u679c\u4f60\u770b\u5230\u7c7b\u4f3c\u4e0a\u9762\u7684\u63d0\u9192\uff0c\u90a3\u4e48\u8bf4\u660e\u4f60\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u4e86ns-2\u3002<\/p>\n<p>\u4f46\u8fd9\u4e2a\u754c\u9762\u4e5f\u5728\u63d0\u9192\u4f60\u9700\u8981\u8bbe\u7f6e\u4e00\u4e9b\u73af\u5883\u53d8\u91cf\uff0c\u6253\u5f00\u4f60\u7684shell\u53d8\u91cf\u914d\u7f6e\u6587\u4ef6\uff0c\u4e00\u822c\u5728\u4e3b\u76ee\u5f55\u4e0b\uff0c\u4ee5Bash\u4e3a\u4f8b\uff0c\u6253\u5f00.bashrc\u6587\u4ef6\uff0c\u5728\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u51e0\u884c\uff1a<\/p>\n<p>export PATH=&#8221;$PATH:\/<em>home\/UserName<\/em>\/ns-allinone-2.35\/bin:\/<em>home\/UserName<\/em>\/ns-allinone-2.35\/tcl8.5.10\/unix:\/<em>home\/UserName<\/em>\/ns-allinone-2.35\/tk8.5.10\/unix&#8221;<br \/>\nexport LD_LIBRARY_PATH=&#8221;$LD_LIBRARY_PATH:\/<em>home\/UserName<\/em>\/ns-allinone-2.35\/otcl-1.14,\u00a0\/<em>home\/UserName<\/em>\/ns-allinone-2.35\/lib&#8221;<br \/>\nexport TCL_LIBRARY=&#8221;$TCL_LIBRARY:\/<em>home\/UserName<\/em>\/ns-allinone-2.35\/tcl8.5.10\/library&#8221;<\/p>\n<p>\u5c06\/home\/UserName\u66ff\u4ee3\u4e3a\u4f60\u7684\u4e3b\u76ee\u5f55\u5373\u53ef\u3002<\/p>\n<p>\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u66f4\u65b0\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n<p>source .bashrc<\/p>\n<p>\u73b0\u5728\u4f60\u53ef\u4ee5\u8bd5\u8bd5\u4e86\uff0c\u8fd0\u884cns\u4f1a\u5f97\u5230%\u7684\u8fd0\u884c\u7b26\uff0cexit\u9000\u51fa\u3002<\/p>\n<p>\u5728ns-2.35\u76ee\u5f55\u4e0b\u6709validate\u6587\u4ef6\uff0c\u53ef\u4ee5\u8fd0\u884c\u6765\u6d4b\u8bd5\u53ef\u7528\u6027\uff0c\u8fd9\u662f\u5b98\u65b9\u7684\u6d4b\u8bd5\u811a\u672c\uff0c\u6211\u4eec\u53ef\u4ee5\u4e0d\u505a\u8fd9\u4e00\u6b65\uff0c\u76f4\u63a5\u8fdb\u5165ns-allinone-2.35\/ns-2.35\/tcl\/ex\uff0c\u8fd9\u91cc\u6709\u5f88\u591a\u4f8b\u5b50\uff0c\u8fd0\u884cns simple.tcl\u5c31\u4f1a\u6709\u4e24\u4e2a\u56fe\u5f62\u5316\u7a97\u53e3\u8e66\u51fa\u6765\uff0c\u8fd9\u5c31\u662fnam\u4e86\u3002<\/p>\n<p><a href=\"https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-05-03-33.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-82\" src=\"https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-05-03-33.png\" alt=\"\" width=\"779\" height=\"478\" srcset=\"https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-05-03-33.png 779w, https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-05-03-33-300x184.png 300w, https:\/\/windywind.tk\/wp-content\/uploads\/2016\/03\/Screenshot-from-2016-03-07-05-03-33-768x471.png 768w\" sizes=\"(max-width: 779px) 100vw, 779px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ns-2\u662fUSC\u548c\u5176\u4ed6\u51e0\u4e2a\u673a\u6784\u5f00\u53d1\u7684\uff0c\u76ee\u524d\u7531\u00a0USC\/Information Sciences Institu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-2"],"_links":{"self":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts\/80"}],"collection":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=80"}],"version-history":[{"count":3,"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions"}],"predecessor-version":[{"id":407,"href":"https:\/\/windywind.tk\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions\/407"}],"wp:attachment":[{"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windywind.tk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}