/* 
* Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#
*/ 

TEST NAME 

      cl2se2 - TCP test

SYNOPSIS 

      sh se2 <-c connections> <-p port> <SERVERNAME>
      sh cl2 <-c connections> <-p port> SERVERNAME

DESCRIPTION 

      This is a TCP test that transmits a complex pattern from a client to a
      server. The server receives and verifies the data.

OPERANDS 

      -c connections
                   This specifies the number of connections to make or accept.
		   The values may be different on client and server if, for
		   example you wanted 20 instances on one server, and 10
		   instances on each of two clients.

		   Defaults to 1.

      -p port      The TCP port to use in connections.

		   Defaults to 4004.

      SERVERNAME   Either a local host name or the IP address of a machine. On
                   the client side, SERVERNAME is the host to which to connect,
                   and on the server side, SERVERNAME is the address to which
                   to listen. If a host name is specified, it must appear in
                   /etc/hosts along with the remote machine's IP address.

		   SERVERNAME is optional for the server. It defaults to the
		   value returned by gethostname(3C).

USAGE VARIABLES 

      RUNTIME   This environment variable specifies, in seconds, the duration 
                of the test. This variable is required only on the client side.

SETUP 

      You need two machines connected by a network, either back-to-back, or
      through a hub or switch.

OUTPUT 

      The server initially produces a single line indicating the IP address and
      port to which it is bound and listening. As each incoming connection is
      received, it shows the IP the incoming connection was from.

      After the expected number of incoming connections have been received, it
      indicates it is waiting for the child processes (one per connection) to
      complete.

      Similarly, the client indicates which server it will attempt to connect
      to, and will indicate each process as it starts.

      Finally, each child process completes and indicates the number of blocks
      (each of size 65Kb) and the exit status is reported (normally zero).

DURATION 

      24 hours

POSSIBLE CONCURRENT TESTS 

      This test can run concurrently with lsalr, mpflip, rcp, and ftpstress.

CAVEATS 

      * The 'cl3' test should be run on the client side. The 'se3' represents
        the server version.

      * When running the test, the server side should be executed first, before
        the client; otherwise, the test fails.

EXAMPLES 

      On the server side: 

      # ./se3 -c 2 
      Server jetman 129.156.228.84.4004 is bound
      Starting server 0 - Accept 129.156.228.52
      Starting server 1 - Accept 129.156.228.52
      Waiting for child processes...
      EOF 29 secs, 149 blocks
      Process 15459 terminated, status 0
      EOF 30 secs, 77 blocks
      Process 15458 terminated, status 0
      !PASS: No failures detected
      #


      On the client side: 

      # ./cl3 -c 2 jetman    
      (client) Server jetman 129.156.228.84.4004
      Client 0 connected - starting to transmit
      Waiting for child processes...
      Client 1 connected - starting to transmit
      client 1: No errors after 30 seconds - sent 149 blocks
      Process 19631 terminated, status 0
      client 0: No errors after 30 seconds - sent 77 blocks
      Process 19630 terminated, status 0
      !PASS: No failures detected
      # 


REFERENCES 

      read(2), write(2), hosts(4), tcp(7P)
