[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Problems using TcpApp wit FullTcp
Hello all,
I am trying to use TcpApp over FullTcp to simulate some application
behaviour. While doing that I run into a problem while connecting different
apps. What I would like to accomplish is the following:
I have a linear topology of three nodes with an attached FullTcp agent:
(1)-----------(2)-----------(3)
After that I create three apps and put the TCP agent at the second node in
the listen state. And connect tcp1 with tcp2 with app1 and app2.
Now app1 sends a message to app2. This all works great. Now because of this
message app2 needs to contact app3. So I connect tcp2 with tcp3 and app2
with app3 and I put tcp3 in listen mode.
When I now send a message from app2 to app3 I only see ACK packets without
TCP packets. I suspect this occurs because tcp2 is still in a different
state then when you create it. I tried to do a "$tcp2 reset" but that
doesn't solve my problem. Below I have include the tcl script, the ns output
and the tracefile.
Unfortunately I couldn't find any information on this in the documentation
or the list-archive. I have looked at the webcache testsuite. But that only
test a 2-node setup (with TcpApp and FullTcp) and that works fine.
Do you have any ideas of how I should accomplish this?
Thanks,
Mark Janssen
###begin tcpapp.tcl
#Create a simulator object
set ns [new Simulator]
#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Open the trace file
set f [open out.tr w]
$ns trace-all $f
#Define a 'finish' procedure
proc finish {} {
global ns nf f
$ns flush-trace
close $f
#Close the trace file
close $nf
#Execute nam on the trace file
# exec nam out.nam &
exit 0
}
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n1 $n2 1Mb 80ms DropTail
$ns duplex-link $n2 $n3 1Mb 80ms DropTail
Application/TcpApp instproc app-recv {src size} {
global ns
puts "[$ns now] $self recieves data $size from $src"
$ns trace-annotate "$self recieves data $size from $src"
# $self send 100 "$self send 100 \"$src app-recv $self 100\""
}
set tcp1 [new Agent/TCP/FullTcp]
set tcp2 [new Agent/TCP/FullTcp]
set tcp3 [new Agent/TCP/FullTcp]
$ns attach-agent $n1 $tcp1
$ns attach-agent $n2 $tcp2
$ns attach-agent $n2 $tcp3
set app1 [new Application/TcpApp $tcp1]
set app2 [new Application/TcpApp $tcp2]
set app3 [new Application/TcpApp $tcp3]
$ns connect $tcp1 $tcp2
$app1 connect $app2
#Call the finish procedure after 5 seconds of simulation time
$ns at 0.1 "$tcp2 listen ; $app1 send 100 \"$app2 app-recv $app1 100\""
$ns at 4.0 "$ns connect $tcp2 $tcp3 ; $app2 connect $app3; $tcp3 listen;
$app2 send 100 \"$app3 app-recv $app2 100\""
$ns at 7.0 "finish"
#Run the simulation
$ns run
###end tcpapp.tcl
###begin ns-output
[mjanssen@mjlaptop myscripts]$ ns tcpapp.tcl
0.34207999999999994 _o65 recieves data 100 from _o64
4.000000: FullTcpAgent::recv(_o60) got packet lacking ACK (seq 101)
4.100000: (_o61) unexpected timeout 3 in state 1
4.600000: FullTcpAgent::recv(_o60) got packet lacking ACK (seq 101)
4.600000: (_o61) unexpected timeout 3 in state 1
5.800000: FullTcpAgent::recv(_o60) got packet lacking ACK (seq 101)
5.800000: (_o61) unexpected timeout 3 in state 1
[mjanssen@mjlaptop myscripts]$
###end ns-output
###begin out.tr
+ 0.1 0 1 tcp 40 ------- 0 0.0 1.0 0 0
- 0.1 0 1 tcp 40 ------- 0 0.0 1.0 0 0
r 0.18032 0 1 tcp 40 ------- 0 0.0 1.0 0 0
+ 0.18032 1 0 ack 40 ------- 0 1.0 0.0 0 1
- 0.18032 1 0 ack 40 ------- 0 1.0 0.0 0 1
r 0.26064 1 0 ack 40 ------- 0 1.0 0.0 0 1
+ 0.26064 0 1 tcp 40 ------- 0 0.0 1.0 1 2
- 0.26064 0 1 tcp 40 ------- 0 0.0 1.0 1 2
+ 0.26064 0 1 tcp 140 ------- 0 0.0 1.0 1 3
- 0.26096 0 1 tcp 140 ------- 0 0.0 1.0 1 3
r 0.34096 0 1 tcp 40 ------- 0 0.0 1.0 1 2
r 0.34208 0 1 tcp 140 ------- 0 0.0 1.0 1 3
v 0.34207999999999994 eval {set sim_annotation {_o65 recieves data 100 from
_o64}}
+ 0.4 1 0 ack 40 ------- 0 1.0 0.0 1 4
- 0.4 1 0 ack 40 ------- 0 1.0 0.0 1 4
r 0.48032 1 0 ack 40 ------- 0 1.0 0.0 1 4
###end out.tr