这个函数保存buffer中的数据到一个参数里。这个函数是用来在脚本中做关联的。
前两个参数是为了指定特定的参数。
在指定活动的socket和buffer之后,需要指定一个参数来保存数据。指定偏移量来显示buffer中数据的偏移量和数据的长度。
保存了参数之后,可以在脚本和数据文件使用它,代替所有需要替代的值。替换时要用选项中的定义的符号来引用。
注意:要从buffer中保存一个编码过的数据到参数中,要用lrs_save_param_ex函数。 |
这个函数保存一个buffer或者一个buffer的某一部分到参数中。这个变量指定buffer中某种类型的数据被保存:用户buffer,录制的buffer,或者上一个接收到的buffer.推荐使用在用户数据中。
[Z1] |
lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=192.168.1.114:5560", LrsLastArg);
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_create_socket("socket1", "TCP", "LocalHost=0", "RemoteHost=192.168.1.114:5560", LrsLastArg);
lrs_send("socket1", "buf2", LrsLastArg);
lrs_receive("socket1", "buf3", LrsLastArg); |
;WSRData 2 1
send buf0 50
"OPERTYPE(LOGIN)ACCOUNTNAME(admin)PASSWORD(admin)"
recv buf1 155
"DATALEN{{155}}000000USERID{{90}}USERNAME{{DMS"
"\xcf\xb5\xcd\xb3"
"WEB"
"\xb2\xe9\xd1\xaf\xd5\xca\xbb\xa7"
"}}USERDESCRIBE{{"
"\xba\xfe\xd6\xdd\xb5\xe7\xc1\xa6\xbe\xd6"
"\\DMS"
"\xcf\xb5\xcd\xb3"
"WEB"
"\xb2\xe9\xd1\xaf\xd5\xca\xbb\xa7"
"}}DEPARTNAME{{"
"\xce\xb4\xd6\xaa"
"}}ADMIN{{0}}CLIENTSESSIONID{{2}}"
send buf2 53
"CLIENTSESSIONID(2)OPERTYPE(INITDEPARTLIST)"
recv buf3 683
"DATALEN{{683}}000000XMLDATA{{<?xml version=\"1.0\" encoding=\"GB2312\"?>\n"
"<!DOCTYPE DepartList>\n"
"<DepartList>\n"
………………………………………………………………………………………………
这里就省略了些数据。反正也看着也晕乎乎的。 |
Virtual User scrīpt started
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(4): lrs_create_socket(socket0, TCP, ...)
Action.c(6): lrs_send(socket0, buf0)
Action.c(8): lrs_receive(socket0, buf1)
Action.c(11): lrs_create_socket(socket1, TCP, ...)
Action.c(13): lrs_send(socket1, buf2)
Action.c(15): lrs_receive(socket1, buf3)
Action.c(15): Mismatch (expected 683 bytes, 42 bytes actually received)
Action.c(17): lrs_create_socket(socket2, TCP, ...)
Action.c(19): lrs_send(socket2, buf4)
Action.c(21): lrs_receive(socket2, buf5)
Action.c(21): Mismatch (expected 34143 bytes, 42 bytes actually received)
Action.c(23): lrs_create_socket(socket3, TCP, ...)
Action.c(25): lrs_send(socket3, buf6)
Action.c(27): lrs_receive(socket3, buf7)
Action.c(27): Mismatch (expected 100 bytes, 42 bytes actually received)
Action.c(29): lrs_create_socket(socket4, TCP, ...)
Action.c(31): lrs_send(socket4, buf8)
Action.c(33): lrs_receive(socket4, buf9)
Action.c(33): Mismatch (expected 134 bytes, 42 bytes actually received)
Action.c(35): lrs_send(socket4, buf10)
Action.c(38): lrs_receive(socket4, buf11)
Action.c(38): Mismatch (expected 17520 bytes, 42 bytes actually received)
Action.c(41): lrs_create_socket(socket5, TCP, ...)
Action.c(43): lrs_send(socket5, buf12)
Action.c(45): lrs_receive(socket5, buf13)
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated. |
DATALEN{{155}}000000USERID{{90}}USERNAME{{DMS\xcf\xb5\xcd\xb3WEB\xb2\xe9\xd1\xaf\xd5\xca\xbb\xa7}}USERDESCRIBE{{\xba\xfe\xd6\xdd\xb5\xe7\xc1\xa6\xbe\xd6\\DMS\xcf\xb5\xcd\xb3WEB\xb2\xe9\xd1\xaf\xd5\xca\xbb\xa7}}DEPARTNAME{{\xce\xb4\xd6\xaa}}ADMIN{{0}}CLIENTSESSIONID{{2}} |
lrs_save_searched_string( "socket0", LRS_LAST_RECEIVED, "Parameter3", NULL, NULL, -1, 152, 1 ); |
lrs_save_searched_string("socket0",LRS_LAST_RECEIVED,"Parameter4","LB/BIN=SESSIONID{{", "RB/BIN=}}", 1, 0, -1); |
lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=192.168.1.114:5560", LrsLastArg);
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_save_searched_string("socket0", LRS_LAST_RECEIVED, "Parameter1", "LB/BIN=SESSIONID{{", "RB/BIN=}}", 1, 0, -1);
lr_output_message("小样还抓不到你!你不就是: %s嘛!",lr_eval_string("{Parameter1}")); lrs_create_socket("socket1", "TCP", "LocalHost=0", "RemoteHost=192.168.1.114:5560", LrsLastArg);
lrs_send("socket1", "buf2", LrsLastArg);
lrs_receive("socket1", "buf3", LrsLastArg); |
Virtual User scrīpt started
Starting action vuser_init.
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(4): lrs_create_socket(socket0, TCP, ...)
Action.c(6): lrs_send(socket0, buf0)
Action.c(8): lrs_receive(socket0, buf1)
Action.c(10): lrs_save_searched_string(socket0, get_last_received_buffer, Parameter1, LB/BIN=SESSIONID{{, RB/BIN=}}, 1, 0, -1)
Action.c(12): 小样还抓不到你!你不就是: 8嘛!
Action.c(14): lrs_create_socket(socket1, TCP, ...)
Action.c(16): lrs_send(socket1, buf2)
Action.c(18): lrs_receive(socket1, buf3)
Action.c(20): lrs_create_socket(socket2, TCP, ...)
Action.c(22): lrs_send(socket2, buf4)
Action.c(24): lrs_receive(socket2, buf5)
Action.c(26): lrs_create_socket(socket3, TCP, ...)
Action.c(28): lrs_send(socket3, buf6)
Action.c(30): lrs_receive(socket3, buf7)
Action.c(32): lrs_create_socket(socket4, TCP, ...)
Action.c(34): lrs_send(socket4, buf8)
Action.c(36): lrs_receive(socket4, buf9)
Action.c(38): lrs_send(socket4, buf10)
Action.c(41): lrs_receive(socket4, buf11)
Action.c(44): lrs_create_socket(socket5, TCP, ...)
Action.c(46): lrs_send(socket5, buf12)
Action.c(48): lrs_receive(socket5, buf13)
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated. |