Changeset 16218 for misc/runpugs/bin
- Timestamp:
- 05/07/07 16:26:38 (19 months ago)
- Location:
- misc/runpugs/bin
- Files:
-
- 3 added
- 3 modified
-
multi_client_model.pl (modified) (4 diffs)
-
perl_repl.pl (added)
-
termdispatcher.pl (modified) (1 diff)
-
termserv.pl (modified) (1 diff)
-
test_session.pl (added)
-
test_session_dispatcher.pl (added)
Legend:
- Unmodified
- Added
- Removed
-
misc/runpugs/bin/multi_client_model.pl
r15833 r16218 6 6 use strict; 7 7 8 use threads; # pull in threading routines8 #use threads; # pull in threading routines 9 9 10 10 use lib '../lib/'; … … 19 19 our $nclients_serial=500; 20 20 21 #for my $i (0..$n_threads-1) { 22 # $threads[$i]=threads->create("client_session",$i); 23 #} 24 25 # program exits when first thread exits 26 my $pid; 21 27 for my $i (0..$n_threads-1) { 22 $threads[$i]=threads->create("client_session",$i); 23 } 24 25 # program exits when first thread exits 26 $threads[0]->join(); 28 if($pid=fork()) { 29 print "Spawned $i\n"; 30 } elsif (defined $pid) { # Child 31 print "Running $i\n"; 32 &client_session($i); 33 exit(0); 34 } else { 35 die "Fork failed!"; 36 } 37 } 38 print "Parent: done creating clients."; 39 sleep 3600; 40 #$threads[0]->join(); 27 41 28 42 … … 108 122 print "$i:WARNING2: $cmd<>$reply\n";# if $v; 109 123 #if ($reply eq '0') { 110 system("./killall_perl"); 124 #system("./killall_perl"); 125 kill 9,getppid(); 111 126 exit() ; 112 127 #} … … 118 133 } elsif ($abort) { 119 134 &send_cmd(':A',$id,$ip,$app); 120 } #� therwise do nothing, server should time the session out135 } #�otherwise do nothing, server should time the session out 121 136 my $w_log= rand($w_max_log)+$w_min_log; 122 137 my $wait=int(2**$w_log); 123 138 print "\n$i:Waiting for $wait seconds...\n" if $v; 124 139 sleep $wait; 125 } #� nd of nclients_serial loop140 } #�end of nclients_serial loop 126 141 127 142 } -
misc/runpugs/bin/termdispatcher.pl
r14512 r16218 6 6 # 7 7 use lib '../lib/'; 8 use WebTerminal::Dispatcher; 8 use Web::Terminal::Settings; 9 use Web::Terminal::Dispatcher; 10 #$Web::Terminal::Settings::port=2058; 9 11 10 12 11 13 my $id=$ARGV[0]||-1; 12 my $cmd=$ARGV[1] || 'my $a='.$id.';say "Hello, $a";'; 13 #my $cmd='my $a='.$id.';say "Hello, $a";'; 14 my $prompt='pugs> '; 14 my $cmd=$ARGV[1] || 'print "hello\n";say "there";print 4'; 15 15 print "Sending msg $id: $cmd\n"; 16 16 my $ip="127.0.0.1"; 17 my $dev=1; 18 my $reply = &WebTerminal::Dispatcher::send($id,$ip,$dev,$prompt.$cmd);17 (my $reply,my $prompt,my $histref) = 18 &Web::Terminal::Dispatcher::send($id,$ip,1,1,$cmd); 19 19 print $reply; 20 print "\nHistory\n"; 21 for my $entry (@{$histref}) { 22 print "\t$entry\n"; 23 } 20 24 -
misc/runpugs/bin/termserv.pl
r14233 r16218 1 1 #!/usr/bin/perl 2 use strict; 3 use warnings; 4 #BEGIN { 5 #$ENV{PERLIO}= ":utf8"; 6 #} 7 #use utf8; 8 2 9 use warnings; 3 10 use strict; 4 use utf8; 11 5 12 use lib '../lib/'; 6 use Web Terminal::Server;7 my $host = 'localhost';8 my $port = 2057;13 use Web::Terminal::Server; 14 use Web::Terminal::Settings; 15 $Web::Terminal::Settings::port=2059; 9 16 $ENV{PUGS_SAFEMODE}=1; 10 &WebTerminal::Server::run($host,$port); 17 my $v=1-$Web::Terminal::Settings::daemon; 18 print "Starting server\n" if $v; 19 &Web::Terminal::Server::run(); 11 20
