|
3#
楼主 |
发表于 2010-10-8 16:41:19
|
只看该作者
回复 2# baikunhu
谢谢...~~
我的问题是脚本完成后回放、调试和运行都是正常,可是加入场景后,并发多个用户(实验中是50个),执行场景,运行结果显示极少数运行成功,其他失败的原因就是上述的错误信息。
具体代码如下:
#include "web_api.h"
Action()
{
int flen,rNum; //定义一个整型变量保存获得文件的大小
long filedes; //保存文件句柄
char filepath[512],filename[512]; //保存文件路径及文件名
rNum = rand() % 10000000;//生成一个随机的文件全路径名
itoa(rNum, filename, 10);
strcpy(filepath,"D:\\File\\");//假如下载的文件保存到F盘的Flie文件夹下
strcat(filepath,filename);
strcat(filepath,".zip");//下载文件的后缀名
web_url("lus",
"URL=http://10.27.146.118:6020/sec/lus",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=struts/ext/resources/css/ext-all.css", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/tags/js/ext-tag-lang-zh_CN.js", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=lus/images/login.png", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/ext/resources/images/default/button/btn-sprite.gif", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/ext/resources/images/default/form/text-bg.gif", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
"Url=struts/ext/resources/images/default/qtip/tip-sprite.gif", "Referer=http://10.27.146.118:6020/sec/lus/preUserLogin.do", ENDITEM,
LAST);
web_url("autoDownload.action",
"URL=http://10.27.146.118:6020/sec/autoDownload.action?LAC=WD-WMAM9U&ESN=WD-WMAM9UV67594&productName=USG5320&productVersion=V100R003&modeName=UTMFWE04",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
EXTRARES,
LAST);
lr_rendezvous("所有下载用户到达集合点");
lr_start_transaction("HTTP下载特征库");
web_set_max_html_param_len("90000000");
web_reg_save_param("fcontent","LB=","RB=","SEARCH=BODY",LAST);
web_url("Download",
"Url=http://10.27.146.118:6020/SignatureDownload/LUS_AV_S1_1285488600037.zip",
"Referer=",
EXTRARES,
LAST);
flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE); //获得文件大小
if(flen > 0)
{
if((filedes = fopen(filepath, "wb")) == NULL)
{
lr_output_message("Open File Failed!");
return -1;
}
fwrite( lr_eval_string("{fcontent}"),flen,1,filedes );/*把关联的数据写入文件*/
fclose( filedes );/* 关闭文件流 */
}
lr_end_transaction("HTTP下载特征库",LR_AUTO);
return 0;
} |
|