[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About the TcpApp. help!!!
You didn't follow that example script in two points:
(1) call $app1 connect $app2 before sending anything
(2) use
$ns at 1.0 "$app1 send 100 \"$app2 app-recv 100\""
instead of separating them into two commands.
- Haobo
On Fri, 4 Dec 1998, Zhu Ming wrote:
> Hi,
>
> I just run the TcpApp example file in the ns doc. But it seems work bad,
> who can help me???
>
> many thanks,
> ------------------error data:
> ns tcpapp.tcl
> 1 app2 receives data 100 from app1
> Bus error (core dumped)
> ----------------------------
> prog:
> #Create a simulator object
> set ns [new Simulator]
>
> #Open a 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 $nf
> exec nam out.nam &
> exit 0
> }
>
> #Create three nodes
> set n2 [$ns node]
> set n1 [$ns node]
>
> ######################
> # Link definition
> ######################
> $ns duplex-link $n1 $n2 10Mb 2ms DropTail
>
>
> # Set up TCP connection
> # set tcp1 [$ns_ create-connection TCP $n1 TCPSink $n2 0]
> # $tcp1 set window_ 30
> set tcp1 [new Agent/TCP/FullTcp]
> set tcp2 [new Agent/TCP/FullTcp]
>
> $ns attach-agent $n1 $tcp1
> $ns attach-agent $n2 $tcp2
> $ns connect $tcp1 $tcp2
> $tcp2 listen
>
> Application/TcpApp instproc app-recv {size} {
> global ns
> puts "[$ns now] app2 receives data $size from app1"
> }
>
> set app1 [new Application/TcpApp $tcp1]
> set app2 [new Application/TcpApp $tcp2]
>
> $ns at 1.0 "$app1 send 100"
> $ns at 1.0 "$app2 app-recv 100"
> $ns at 1.5 "finish"
>
> #Run the simulation
> $ns run
>
>
>
>
>