#! c:\perl\bin\perl.exe # This is an example client. It is included here to demonstrate how the server Perl program might be driven by a client. # Input is the host name and the port to use. It opens a TCP/IP connection to the server and then waits for user input. # The user input is a string which tells the server how to configure WTP, to start or stop WTP or to query the # build ID. The client then sends that string to the server where the server carries out the command. # In the actual test-client perl script no user input is needed. The script has a set of tests it runs automatically. # Before a run, the script sends messages to the server instructing it how to configure WTP for the upcoming # test. The client then executes the test, gathers the results and starts the next test case. # Before running this script at the client, make sure the server side script is running. $HOST = $ARGV[0]; $PORT = $ARGV[1]; die "usage: perl $0 HOST PORT\n" unless ($PORT && $HOST); # prompt the user with the set of acceptable commands. can be either proxy or servlet. print "Commands:\n start ,\n stop ,\n proxybackbone,\n proxyimage,\n proxytext,\n proxyboth,\n servletbackbone,\n servletimage,\n servlettext,\n servletboth,\n build \n exit\n"; use IO::Socket; $TO_SERVER = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $HOST, PeerPort => $PORT, ) or die "cannot connect $HOST at $PORT"; while ($line = ) { # read command in and send it to server print ("Sending to host: $line"); print $TO_SERVER "$line"; last if ($line =~ /exit/); if ($line =~ /build/) { # if 'build' is the command, server replies with buildID info $build = <$TO_SERVER>; print "$build"; # print out the build id } } exit(0);