Hi,
 I got the answer to both of my questions.Now I want to
prevent the receiver from sending ACK packets to see
if the sender send the packets again or not.
 I've added the corrected script to the end of this mail, as
an example for other who might have the same problem.

Thanks,
Mobin



A sample for TCP connection simulation in NS2:

set ns [new Simulator]

# NAM file
set nf [open outtcp1.nam w]
$ns namtrace-all $nf

# finish procedure
proc finish {} {
 global ns nf
 $ns flush-trace
 close $nf
 exec nam outtcp1.nam &
 exit 0
}


# create nodes
set n0 [$ns node]
set n1 [$ns node]

$ns duplex-link $n0 $n1 1Mb 100ms DropTail

# create TCP agents
set src [new Agent/TCP/FullTcp]
set sink [new Agent/TCP/FullTcp]

$ns attach-agent $n0 $src
$ns attach-agent $n1 $sink

$src set fid_ 0
$src set fid_ 0

$ns connect $src $sink

# set up TCP-level connections
$sink listen
$src set window_ 100

# create traffic generator
set ftp0 [new Application/FTP]
$ftp0 attach-agent $src


# run NS
$ns at 0.5 "$ftp0 start"
$ns at 5.0 "finish"
$ns run



---------- Forwarded message ----------
From: Mobin Yazarlou <yazarlo...@gmail.com>
Date: Tue, Sep 14, 2010 at 9:44 AM
Subject: How to monitor TCP three way handshaking in NS2?
To: ns-users@isi.edu


Hi,
 Based on what I read in NS manual, FullTcp agent supports TCP
three way handshaking but I don't know if it is possible to
monitor this process or not.
 And also, I've got a problem with this agent.Could you take
a look at the following script and tell me why it gives an
error on "new Agent/TCP/FUllTcp" ? I am using ns-2.34 all in
one package.

Thanks,
Mobin


[1]    set ns [new Simulator]
[2]
[3]    # NAM file
[4]    set nf [open outtcp1.nam w]
[5]    $ns namtrace-all $nf
[6]
[7]    # finish procedure
[8]    proc finish {} {
[9]     global ns nf
[10]     $ns flush-trace
[11]     close $nf
[12]     exec nam outtcp1.nam &
[13]     exit 0
[14]    }
[15]
[16]
[17]    # create nodes
[18]    set n0 [$ns node]
[19]    set n1 [$ns node]
[20]
[21]    $ns duplex-link $n0 $n1 1Mb 100ms DropTail
[22]
[23]    # create TCP agents
[24]    set src [new Agent/TCP/FUllTcp]
[25]    set sink [new Agent/TCP/FullTcp]
[26]
[27]    $ns attach-agent $n0 $src
[28]    $ns attach-agent $n1 $sink
[29]
[30]    $src set fid_ 0
[31]    $src set fid_ 0
[32]
[33]    $ns connect $src $sink
[34]
[35]    # set up TCP-level connections
[36]    $sink listen
[37]    $src set window_ 100;
[38]
[39]
[40]
[41]
[42]    # run NS
[43]    $ns at 0.5 "$src start"
[44]    $ns at 5.0 "finish"
[45]    $ns run


r...@ubuntu:~/NS234/mycodes# ns tcp1.tcl
invalid command name "Agent/TCP/FUllTcp"
    while executing
"Agent/TCP/FUllTcp create _o36 "
    invoked from within
"catch "$className create $o $args" msg"
    invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
    (procedure "new" line 3)
    invoked from within
"new Agent/TCP/FUllTcp"
    invoked from within
"set src [new Agent/TCP/FUllTcp]"
    (file "tcp1.tcl" line 24)
r...@ubuntu:~/NS234/mycodes#

Reply via email to