web_set_sockets_option("SHUTDOWN","ABRUPT");执行报错
在lr11的 脚本Action的函数前添加了如下函数还是报错: web_set_sockets_option("SHUTDOWN_MODE",Abrupt); ---相当于reset操作;最后添加下行:
web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS",1);
脚本:
int web_set_sockets_option("SHUTDOWN","ABRUPT");
char *a="{\"appcode\":1}";
web_set_max_html_param_len("262144");
web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body", LAST);
lr_start_transaction("denglu");
web_url("doLogin.jhtml",
"URL=http://192.168.51.25/aos/doLogin.jhtml?account_={name}&password_={psw}",
"Resource=1",
"Referer=",
"Snapshot=t12.inf",
LAST);
if(strcmp(lr_eval_string("{ResponseBody}"),a)==0){
lr_message( "The status is success" );
lr_end_transaction("denglu", LR_AUTO);
}
else{
lr_message( "The status is fail" );
lr_end_transaction("denglu", LR_FAIL);
}
web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS",1);
return 0;
报错:
Action.c (4): syntax error; found "SHUTDOWN" expecting `)'
Action.c (4): skipping "SHUTDOWN" `,' "ABRUPT"
c:\\\275\305\261\276\\account\\\\combined_account.c (5): 2 errors, not writing pre_cci.ci
设置ip欺骗,运行场景5个虚拟用户后报错,发现是一个用户占用了多个ip还没有释放,所以才添加此web_set_sockets_option函数
loadrunner菜鸟一枚,求指点,先谢谢了 呃,找到问题了,被自己蠢到了 jane_fun_hua 发表于 2016-11-21 17:50
呃,找到问题了,被自己蠢到了
是否愿意分享下问题呢。。。。。 网上说的方法,要在loadrunner11中要变成如下
web_set_sockets_option("SHUTDOWN_MODE","ABRUPT");
web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS","1");
仅仅语法问题 web_set_sockets_option("SHUTDOWN_MODE","ABRUPT");
web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS","1");
请问这两句话,要添加到Action中的什么位置?我把第一句加在了事务开始前,第二句加在了return 0 前面,但是报错
Unresolved symbol,能不能麻烦楼主指点一下 麻烦大神帮忙看看,
报错如下,好像跟您的一样
Action.c (17): syntax error; found "SHUTDOWN_MODE" expecting `)'
Action.c (17): skipping "SHUTDOWN_MODE" `,' "ABRUPT"
e:\\boeing\317\265\315\263\274\334\271\271\323\305\273\257\\uep\327\250\317\356\262\342\312\324\\calccdserv\\\\combined_CalCCDServ.c (4): 2 errors, not writing pre_cci.ci
代码如下
#include "lrs.h"
Action()
{
int web_set_sockets_option("SHUTDOWN_MODE","ABRUPT");
//发送报文部分
char toKmc = "\0";
char toKmc1 = "1234\0";
//接收报文部分
char *valBufRecv; //记录接收到的数据包
int lenBufRecv = 0; //记录接收数据包的长度
char *posRespCode;
char valRespCode="\0";
memset( valRespCode, 0, 3);
strcat( toKmc, toKmc1);
lr_start_transaction("1");
ErrCode = lrs_create_socket( "socket0", "TCP", "LocalHost=0", "RemoteHost=192.168.1.1:80", LrsLastArg);
if ( ErrCode != 0 )
{
lr_error_message("Create Socket failed!");
lr_end_transaction( "1", LR_FAIL);
return 0;
}
lrs_set_send_buffer( "socket0", (char *)toKmc, strlen(toKmc) );
lrs_length_send( "socket0", "buf0", 0, LrsLastArg);
lrs_set_recv_timeout( 10, 0);
lrs_set_recv_timeout2( 0.01, 0);
lrs_receive( "socket0", "buf1", LrsLastArg);
lrs_get_last_received_buffer( "socket0", &valBufRecv, &lenBufRecv);
if ( lenBufRecv == 0 )
{
lr_error_message( "No Received Data!" );
ErrCode = lrs_close_socket( "socket0");
if ( ErrCode != 0 )
{
lr_error_message("Close Socket failed!");
lr_end_transaction( "1", LR_FAIL);
return 0;
}
lr_end_transaction( "1", LR_FAIL);
}
else
{
posRespCode = (char *) strstr( valBufRecv, "<RespCode>");
strncpy( valRespCode, posRespCode+10, 2);
if ( strcmp(valRespCode,"S") == 0)
{
lr_end_transaction( "1", LR_PASS);
}
else
{
lr_error_message( "RespCode is %s", valRespCode);
lr_end_transaction( "1", LR_FAIL);
}
lenBufRecv = 0;
lrs_free_buffer( valBufRecv);
ErrCode = lrs_close_socket( "socket0");
if ( ErrCode != 0 )
{
lr_error_message("Close Socket failed!");
return 0;
}
}
web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS","1");
return 0;
}
页:
[1]