While True Loop

The While True loop repeats the series of grouped activities as long as the given condition evaluates as true. The condition is evaluated when the group is entered. If the condition evaluates to false, the activities within the group are not executed. The following is an example of a While True loop.

The process performs the following operations:

Procedure 

  1. A Wait for TCP Request activity waits for an incoming TCP request.

  2. When a request is received, a transition is taken to a While True loop. The output of the GetEndOfStream activity within the group is accumulated in a variable named endOfStream. This allows the condition of the group to be set as follows:

    not($endOfStream/AccumulatedOutput/EndOfStreamMarker/EndOfStreamReached)

    So, the condition evaluates to true because EndOfStreamReached is false the first time the loop is executed.

  3. Within the group, a Read TCP Data activity reads from the TCP input stream until a separator is reached.

  4. The GetEndOfStream activity retrieves the value of $ReadTCPData/ActivityOutput/endOfStreamReached. This output item of the Read TCP Data activity is set to true when the end of the output stream is reached. So, the GetEndOfStream activity will have an output value of false, until the Read TCP Data activity detects the end of the output stream.

  5. The Process Data process is called to handle the incoming data from the TCP stream.

  6. The loop repeats until the Read TCP Data activity detects the end of the input stream. When this is detected, the loop condition evaluates to false, and the loop exits.