[ns] About trace file

2014-06-13 Thread Rahul Lanjewar

Dear sir,

   How to distinguish and count the sent, dropped and received
packets from trace file in NS2? I only need the data packets(sent, received
and dropped) not control packets like ACK.
Please if there any tool to trace the .tr file then it is good for me.
​

​
Thanks and Regards

 Rahul R Lanjewar
  (9561866782)


[ns] query regarding struct

2014-06-13 Thread prince

Hi,
when i make struct(having two int variable) in mac802-11.h and when i access
struct variable in mac.cc segmentation fault occur ,when i see the struct
reference declared in mac802-11.cc i got it is NULL...
how can i access struct in ns2.
thanks 



--
View this message in context: 
http://network-simulator-ns-2.7690.n7.nabble.com/query-regarding-struct-tp28873.html
Sent from the ns-users mailing list archive at Nabble.com.



[ns] To trace the packets from the trace file

2014-06-13 Thread Rahul Lanjewar

Dear sir,

   How to distinguish and count the sent, dropped and received
packets from trace file? I only need the data packets(sent, received and
dropped) not control packets like ACK.
Please if there any tool to trace the .tr file then it is good for me.

Thanks and Regards

 Rahul R Lanjewar
  (9561866782)


[ns] a problem when execute a example from Section V in Marc Greis' Tutorial

2014-06-13 Thread 管连勇

Hi everybody,
i‘m using ns-allinone-2.35 at CYGWIN_NT-6.1 inagtech 1.7.11(0.260/5/3) 
2012-02-24 14:05 i686 Cygwin,
and start with `Marc Greis' Tutorial for the UCB/LBNL/VINT Network Simulator 
"ns"`.
i write down the example in Section V as following,


# first of all, create a simulator object
set ns [new Simulator]


# open a file for writing which is going to be used for the nam trace data
set nf [open example2.nam w]
$ns namtrace-all $nf


# 'finish' procedure that closes the trace file and starts nam
proc finish {} {
global ns nf
$ns flush-trace
# close the trace file
close $nf
# execute nam on the trace file
exec nam example2.nam &
exit 0
}
# create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
# create three duplex links between the nodes
$ns duplex-link $n0 $n2 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n3 $n2 1Mb 10ms DropTail
# layout these nodes to be nice
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right


# create a UDP agent and attach it to node n0
set udp0 [new Agent/UDP]
# create a CBR traffic source and attach it to udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0


# create a UDP agent and attach it to node n1
set udp1 [new Agent/UDP]
$ns attach-agent $n1 $udp1
# create a CBR traffic source and attach it to udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
$cbr1 attach-agent $udp1


# create a Null agent (a traffic sink) and attach it to node n3
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0


# the two CBR agents have to be connected to the Null agent
$ns connect $udp0 $null0
$ns connect $udp1 $null0


# start and stop the CBR agents
$ns at 0.5 "$cbr0 start"
$ns at 1.0 "$cbr1 start"
$ns at 4.0 "$cbr0 stop"
$ns at 4.5 "$cbr1 stop"


# tell the simulator object to execute the 'finish' procedure after 5.0 seconds 
of simulation time
$ns at 5.0 "finish"


# start the simulation
$ns run


When i execute this example, 
$ns example2.tcl
Segmentation fault (core dumped)
Here is the stackdump file,
Exception: STATUS_ACCESS_VIOLATION at eip=6C7DDF0D
eax= ebx=20074520 ecx=202BCBE8 edx= esi=0003 edi=
ebp=0022AC98 esp=0022AC40 
program=D:\cygwin\opt\ns-allinone-2.35\ns-2.35\ns.exe, pid 5644, thread main
cs=001B ds=0023 es=0023 fs=003B gs= ss=0023
Stack trace:
Frame Function  Args
0022AC98  6C7DDF0D  (202A0410, 01F4, , )
0022ACB8  6CA6D3E6  (202A0410, 01F4, , 61152E7E)
0022ACD8  6C7D699D  (202A4838, 01F4, 6C7D7ED4, 202A0410)
0022ACF8  6C7D6E12  (202A4838, , 0022AD28, 20074520)
0022AD18  6C7D7F0A  (202A4838, 6CB4F59F, 20073680, 6C9F3E24)
0022B148  6C7D67D0  (202A4838, 0002, 0022B264, 6C973B37)
0022B178  6C970CD4  (202A4838, 20073568, 0005, 0022B258)
0022B298  6C973CC2  (202A4688, 20073568, 0003, 20074520)
0022B2C8  6C97A54D  (202A4700, 20073568, 0003, 20074510)
0022B348  6C97E645  (20073568, 0003, 20074510, )
0022B4E8  6C9AF637  (20073568, 202BB960, 000B, 202AFAC8)
0022B528  6C9B9537  (20073568, 202AF9A8, , )
0022B6C8  6C9AF929  (20073568, 2013F398, 0008, 0001)
0022B738  6C9AB7D8  (20073568, 202AFAE0, 0001, 6C9A9C11)
0022B758  6C9AB954  (2009EDB0, 20073568, 0005, 20074428)
0022B7A8  6C97A7A8  (200879C8, 20073568, 0005, 0022B888)
End of stack trace (more stack frames may be present)


But, the example from the tutorial executes well. What have I done wrong? 
Thanks!




The example from the tutorial:
#Create a simulator object
set ns [new Simulator]


#Define different colors for data flows
$ns color 1 Blue
$ns color 2 Red


#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf


#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the trace file
close $nf
#Execute nam on the trace file
exec nam out.nam &
exit 0
}


#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]


#Create links between the nodes
$ns duplex-link $n0 $n2 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n3 $n2 1Mb 10ms SFQ


$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right


#Monitor the queue for the link between node 2 and node 3
$ns duplex-link-op $n2 $n3 queuePos 0.5


#Create a UDP agent and attach it to node n0
set udp0 [new Agent/UDP]
$udp0 set class_ 1
$ns attach-agent $n0 $udp0


# Create a CBR traffic source and attach it to udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0


#Create a UDP agent and attach it to node n1
set udp1 [new Agent/UDP]
$udp1 set class_ 2
$ns attach-agent $n1