Suspends the current thread and waits for a line from the server that matches the specified pattern. If timeout is specified, it indicates the number of milliseconds to wait before giving up. If the timeout expires, the rest of the thread's script is aborted.
The match-commands and timeout-commands are optional command blocks that should be executed when the pattern is received, or when the timeout occurs. If these are omitted, then the script will continue with the next statement when the pattern is received, and will exit the script if a timeout occurs.
NOTE: Normally it is better to create a trigger that fires when a pattern is received from the server. Using WAITFOR will suspend the current thread and will cause parallel threads to be running at the same time. For complicated scripts, using triggers can prevent thread synchronization problems. So WAITFOR should only be used for simple scripts that do not access any global resources.
}
Add comment