LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-23-2010, 11:48 AM   #1
yida
LQ Newbie
 
Registered: Jun 2010
Posts: 13

Rep: Reputation: 0
Monitoring TCP Packet Loss in NS2


Hi,

I am simulating a TCP/FTP to TCP/FTP network and trying to monitor the packet loss.
I am able to monitor and graph data regarding the TCPSinks' bytes received, but I can't monitor packet loss.

Why is it that the TCPSink Agent has a variable for bytes (bytes_) but not one for monitoring packet loss?

Do I have to monitor the packet loss from the queue? If so, how do I write code for this?

Below is part of the code for monitoring bytes received from sinks if anyone was interested.


proc record {} {
global sink sink1 f0 f1 f2
#Get an instance of the simulator
set ns [Simulator instance]
#Set the time after which the procedure should be called again
set time 0.3
#How many bytes have been received by the traffic sinks?
set bw0 [$sink set bytes_]
set bw1 [$sink1 set bytes_]
#Get the current time
set now [$ns now]
#Calculate the bandwidth (in MBit/s) and write it to the files
puts $f0 "$now [expr $bw0/$time*8/1000000]"
puts $f1 "$now [expr $bw1/$time*8/1000000]"
#combination of f0 and f1
puts $f2 "$now [expr $bw0/$time*8/1000000+$bw1/$time*8/1000000]"
#Reset the bytes_ values on the traffic sinks
$sink set bytes_ 0
$sink1 set bytes_ 0
#Re-schedule the procedure
$ns at [expr $now+$time] "record"
}



Thank you for your help.
-Yida
 
Old 06-23-2010, 03:05 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
May be try : Google .. Monitoring TCP Packet Loss in NS2 ..
http://www.google.com/webhp#hl=en&so...ca4f5b132e8dd5

Examples
http://nsnam.isi.edu/nsnam/index.php/Contributed_Code

http://www.eastman-watch.cn/ns-2-pra...ol-principles/
..
 
Old 06-23-2010, 03:05 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
Sorry , browser hick up.



..
 
Old 06-24-2010, 09:00 AM   #4
yida
LQ Newbie
 
Registered: Jun 2010
Posts: 13

Original Poster
Rep: Reputation: 0
I did a fairly extensive google search before posting here.
I've visited the two links above and could not find code for what I needed.

Does anyone see a bug in this code:

First monittor the queue

set qfile [$ns monitor-queue $n2 $n3 [open queue.tr w] 0.05]
[$ns link $n2 $n3] queue-sample-timeout;


then write a prcodure to montior it

set prevDrops 0

proc record {} {
global ns qfile qsize qbw qlost n2 n3 prevDrops
set time 0.05
set now [$ns now]
$qfile instvar parrivals_ pdepartures_ bdrops_ bdepartures_ pdrops_
puts $qsize "$now [expr $parrivals_-$pdepartures_-$pdrops_]"
set bdepartures_ 0
set totalDrops [$qfile set pdrops_]
set currentDrops [expr $totalDrops - $prevDrops]
set prevDrops $totalDrops
puts $qlost "$now $currentDrops"
$ns at [expr $now+$time] "record"
}
 
Old 06-25-2010, 07:06 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,522

Rep: Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503Reputation: 2503
May be ask @ emtarik05 :
http://www.linuxquestions.org/questi...arik05-516518/

Posts by @ emtarik05 are here
http://www.linuxquestions.org/questi...379/page5.html

http://www.linuxquestions.org/questi...379/page2.html
..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NS2.26/TCP installation error? japz20 Linux - Newbie 6 01-16-2013 03:27 AM
ns2 problem: common/packet.h errors de_gr33 General 0 05-25-2009 08:33 PM
How to track TCP/UDP Packet loss for certain period ? neel.gurjar Linux - Networking 2 07-20-2008 01:05 AM
packet loss. bruse Linux - Networking 1 09-01-2005 08:24 AM
70% packet loss bingviini Linux - Networking 5 11-18-2004 11:35 AM


All times are GMT -5. The time now is 10:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration