[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple code-no outpuit-help!



> Hi :
>
> I have created a simple 2 node network and tcp agents to un an ftp applications. but there is no trace produced. can some one tell me what i am doing wrong.
>
> thanks
> Sid
> ----------------------code-----------------------
> set ns [new Simulator]
>
> set nf [open out.nam w]
>
> proc finish {} {
>         global ns nf
>         $ns flush-trace
>         close $nf
>         exec nam out.nam &
>         exit 0
> }
>
> set node0 [$ns node]
> set node1 [$ns node]
>
> $ns duplex-link $node0 $node1 1Mb 10ms DropTail
>
> set src [new Agent/TCP/FullTcp]
> set sink [new Agent/TCP/FullTcp]
> $ns attach-agent $node0 $src
> $ns attach-agent $node1 $sink
> $ns connect $src $sink
>
> $sink listen;
> $src set window_ 100
>
> set ftp1 [new Application/FTP]
> $ftp1 attach-agent $src
>
> Application/FTP instproc start {} {
>         [$self agent] send -1;
> }
>
> $ns namtrace-all $nf
> $ns at 0.0 "ftp start"
> $ns at 10.0 "finish"

I'm wondering which version you're using with? I've used ns-2.1b2 and tested your code above. There were some error and I've changed the code which I'm not sure
exactly what you wanted. Check out the following code.

----------------------code-----------------------
set ns [new Simulator]

set nf [open out.nam w]
$ns namtrace-all $nf         #  Here is the right place I think

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

set n0 [$ns node]
set n1 [$ns node]

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

set src [new Agent/TCP/FullTcp]
set sink [new Agent/TCP/FullTcp]
$ns attach-agent $n0 $src
$ns attach-agent $n1 $sink
$ns connect $src $sink

$sink listen;
$src set window_ 100

set ftp1 [$src attach-source FTP]   #  I don't know anything about Application/FTP

$ns at 0.0 "$ftp1 start"
$ns at 1.1 "finish"
$ns run

Good Luck !

- Haewoon