[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] How to run emulation programs in NS-2?



My OS is Linux 7.1 and the NS version is ns-allinone-2.1b8a.
I tried to run some emulation program, such as the following one:
*********** the program *******************
set stoptime 200.0
set owdelay 1000ms

set myaddr "10.11.12.13"
set ns [new Simulator]

$ns use-scheduler RealTime
set bpf [new Network/Pcap/Live]
$bpf set promisc_ true
$bpf open readonly fxp0

set ipnet [new Network/IP]
$ipnet open writeonly

$bpf filter "icmp and dst $myaddr"

set pfa [new Agent/Tap]
set ipa [new Agent/Tap]
set echoagent [new Agent/PingResponder]

$pfa network $bpf
$ipa network $ipnet

set node0 [$ns node]
set node1 [$ns node]
set node2 [$ns node]
$ns simplex-link $node0 $node2 100Mb $owdelay DropTail
$ns simplex-link $node2 $node1 100Mb $owdelay DropTail

$ns attach-agent $node0 $pfa
$ns attach-agent $node1 $ipa
$ns attach-agent $node2 $echoagent
$ns simplex-connect $pfa $echoagent
$ns simplex-connect $echoagent $ipa

puts "listening for pings on addr $myaddr..."
$ns run
***************end of the program ***************
but it got the following errors:
invalid command name "Network/Pcap/Live"
    while executing
"Network/Pcap/Live create _o11 "
    invoked from within
"catch "$className create $o $args" msg"
    (procedure "new" line 3)
    invoked from within
"new Network/Pcap/Live"
    invoked from within
"set bpf [new Network/Pcap/Live]"
    (file "pingRes.tcl" line 8)
******************end of error message************

what's wrong with it? Can anyone tell me?
In the emulation part of NS Manual, it talks about "nse". How to use it?
Thanks in advance for your help...
______________________________________

===================================================================
������ѵ������� (http://mail.sina.com.cn)
��������ʮ������ҹ�� ���ͼ۸�����μ� (http://cheese.sina.com.cn/ticket.html)
�����ѣ��ҹ�����������ʵ����Ϣ�������˷�����Ϣ (http://classad.sina.com.cn/)