Share this page

# Winsock manual correlation

This topic describes how to use the Editor to manually correlate values in a Winsock Vuser script. It is recommended that you first try to correlate values through the Design Studio. For details, see Winsock correlation.

In the following example, a user performed a telnet session. The user used a ps command to determine the process ID (PID), and killed an application based on that PID.

    Example:
    frodo:/u/user1>ps
       PID TTY      TIME CMD
    14602 pts/18    0:00 clock
    14569 pts/18    0:03 tcsh
    frodo:/u/user1>kill 14602
    [3]    Exit 1                 clock
    frodo:/u/user1>

During execution, the PID of the procedure is different, so killing the recorded PID is ineffective. To overcome this problem, use lrs_save_param_ex to save the current PID to a parameter. Replace the constant PID value with the parameter.

To manually correlate the value:

1. View the buffer contents by selecting data.ws in the Extra File node of the script. Locate the data that you want to replace with the contents of the saved buffer. Use the right-click menu item Replace with Parameter, to replace all instances of the value with the parameter.

2. In the data.ws file, note the buffer in which the data was received, for example buf47.

       Example:
       recv buf47 98
           "\r"
           "\x00"
           "\r\n"
           "   PID TTY      TIME CMD\r\n"
           " 14602 pts/18   0:00 clock\r\n"
           " 14569 pts/18   0:02 tcsh\r\n"
           "frodo:/u/lab>"
       .
       .
       .
       send buf58
           "kill 14602"

3. Determine the offset (starting point) and length of the data string to save. In the above example, the offset of the PID is 11 and its length is 5 bytes. For additional information about displaying the data, see Data buffers.

4. In the recorded section, determine the socket used by buf47. In this example, buf47 used socket1.

   lrs_receive("socket1", "buf47", LrsLastArg);

5. Using the Steps Toolbox, insert an lrs_save_param_ex function in the recorded section, after the lrs_receive for the relevant buffer. In the example, the buffer is buf47. Use the parameter name that you used in Step 1.

   lrs_save_param_ex("socket1", "user", buf47, 11, 5, ascii, param1);

6. Print the parameter to the output using lr_output_message.

   lr_output_message ("param1: %s", lr_eval_string("<param1>"));

Back to top

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 25.1-25.3 All View Local Help Center View Online Help Center Version: