[ns] starting multiple instances of web

Kerilyn O'Donnell k_ann30 at comcast.net
Sun May 16 22:58:38 PDT 2004


Again, I got a rejection notice and hope this e-mail goes through this time, so I'm trying to start multiple occurances of web at the same time in a loop but I can't figure out how to get it to work.  Currently I start web cache/server/client using the following code:

$ns at 0 "start-connection0"



proc start-connection0 {} { 

global ns WServer0 WCache0 WClient0

$WClient0 connect $WCache0

$WCache0 connect $WServer0

$WClient0 start-session $WCache0 $WServer0

}



and I thought that the following would be an adequate replacement but it doesn't work and gives an error, Any ideas would help tremendously:

for {set q 0} {$q < 5 } {incr q} {

$ns at 0 "start-connection0_($q)"

}



proc start-connection0_(0) {} { 

global ns Group0_WServer0_(0) Group1_WCache0_(0) Group2_WClient0_(0) 

$Group2_WClient0_(0) connect $Group1_WCache0_(0) 

$Group1_WCache0_(0) connect $Group0_WServer0_(0) 

$Group2_WClient0_(0) start-session $Group1_WCache0_(0) $Group0_WServer0_(0) 

}





proc start-connection0_(1) {} { 

global ns Group0_WServer0_(1) Group1_WCache0_(1) Group2_WClient0_(1) 

$Group2_WClient0_(1) connect $Group1_WCache0_(1) 

$Group1_WCache0_(1) connect $Group0_WServer0_(1) 

$Group2_WClient0_(1) start-session $Group1_WCache0_(1) $Group0_WServer0_(1) 

}





proc start-connection0_(2) {} { 

global ns Group0_WServer0_(2) Group1_WCache0_(2) Group2_WClient0_(2) 

$Group2_WClient0_(2) connect $Group1_WCache0_(2) 

$Group1_WCache0_(2) connect $Group0_WServer0_(2) 

$Group2_WClient0_(2) start-session $Group1_WCache0_(2) $Group0_WServer0_(2) 

}





proc start-connection0_(3) {} { 

global ns Group0_WServer0_(3) Group1_WCache0_(3) Group2_WClient0_(3) 

$Group2_WClient0_(3) connect $Group1_WCache0_(3) 

$Group1_WCache0_(3) connect $Group0_WServer0_(3) 

$Group2_WClient0_(3) start-session $Group1_WCache0_(3) $Group0_WServer0_(3) 

}





proc start-connection0_(4) {} { 

global ns Group0_WServer0_(4) Group1_WCache0_(4) Group2_WClient0_(4) 

$Group2_WClient0_(4) connect $Group1_WCache0_(4) 

$Group1_WCache0_(4) connect $Group0_WServer0_(4) 

$Group2_WClient0_(4) start-session $Group1_WCache0_(4) $Group0_WServer0_(4) 

}


More information about the Ns-users mailing list