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

Re: Simple Web Server, Cache and client



The syntax of your functions is wrong. They should look like:

proc finish {} {
    global ns log
    $ns flush-trace
    flush $log
    close $log
    exit 0
}

stephen callan wrote:

> Im having trouble compiling this piece of code which is
> very straight forward.
>
> set ns [new Simulator]
>
> # Create topology/routing
> set node(s) [$ns node]
>
> set node(e) [$ns node]
>
> set node(c) [$ns node]
>
> $ns duplex-link $node(c) $node(e) 10Mb 2ms DropTail
>
> $ns duplex-link $node(e) $node(s) 1.5Mb 50ms DropTail
>
> $ns rtproto Session
>
> #HTTP logs
> set log [open "http.log" w]
>
> #create page pool as a central page generator.
> set pgp [new PagePool/Math]
> set tmp [new RandomVariable/Exponential]
> $tmp set avg_ 5
> $pgp ranvar-age $tmp
>
> set server [new Http/Server $ns $node(s)]
>
> $server set-page-generator $pgp
> $server log $log
>
> set cache [new Http/Cache $ns $node(e)]
>
> $cache log $log
>
> set client [new Http/Client $ns $node(c)]
>
> set tmp [new RandomVariable/Exponential]
> $tmp set avg_ 5
> $client set-interval-generator $tmp
> $client set-page-generator $pgp
> $client log $log
>
> set startTime 1
> set finishTime 30
> $ns at $startTime "start-connection"
> $ns at $finishTime "finish"
>
>         proc start-connection
>                 global ns server cache client
>
>                 $client connect $cache
>                 $cache connect $server
>                 $client start-session $cache $server
>
>         proc finish
>                 global ns log
>                 $ns flush-trace
>                 flush $log
>                 close $log
>                 exit 0
>
>                 $ns run
>
> However its giving me this error when I compile it using
>
> NS2.1b5.
>
> wrong # args: should be "proc name args body"
>     while executing
> "proc start-connection"
>     (file "Web1.tcl" line 60)
>
> If anybody knows what might be wrong, Id appreciate the help.
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com

--
______________________________________________________

Felix Hernandez Campos - [email protected]
______________________________________________________

Graduate Student & Research Assistant
Phone#: (919) 962-1948
University of North Carolina at Chapel Hill
Department of Computer Science, Room# 143
CB# 3175, Sitterson Hall
Chapel Hill, NC 27599-3175
______________________________________________________