非常感谢!!
非常感谢!!我测试的是抄股票用的那种行情软件,用socket也不能录制脚本,能不能讲一讲具体的测试步骤?? 真是好贴阿! 好东西,多谢好
正在,找这样的例子 很有学习价值 太感谢了``这方面的资料我找了好久`` 好贴,收藏了,学习 有指导意义,多谢喽~ 救星啊~~我们公司做的全是C/S结构的,做性能测试找资料找了好久~~谢谢楼主分享~~ 下了学习了。。 好贴啊 要顶起来 thanks! 真的很不错 #include "lrs.h"
#define DIR_LEN 100
#define PATH_LEN 128
typedef long time_t;
#ifdef unix
char *filename = "/tmp/logfile.txt";
#else
char *filename = "logfile.txt";
#endif
Action()
{
char *ActualBuffer;
int NumberOfBytes;
long file, thetime;
char original_dir;
char original_path;
int id, id2;
time_t t;
char s;
//lr_start_transaction("connect");
//lr_rendezvous("connect");
lrs_create_socket("socket0", "TCP", "RemoteHost=<server>:5000",LrsLastArg);
//lr_end_transaction("connect", LR_AUTO);
//lr_start_transaction("send");
lrs_send("socket0", "buf0", LrsLastArg);
//lr_end_transaction("send", LR_AUTO);
lrs_receive("socket0", "buf1", LrsLastArg);
lrs_disable_socket("socket0", DISABLE_SEND_RECV);
lrs_get_buffer_by_name("buf1", &ActualBuffer, &NumberOfBytes);
lr_output_message("运行第 %s 轮,buffer size = %d", lr_eval_string("1"),NumberOfBytes);
lrs_save_param_ex("socket0", "user", ActualBuffer, 0, NumberOfBytes, "ascii", "new_parameter");
if(!getcwd(original_dir, DIR_LEN)) {
lr_output_message("getcwd error");
return -1;
}
lr_whoami(&id, NULL, NULL);
sprintf (original_path, "%s\\%d%ld%s", original_dir,id,time(&t), filename);
/* Create a new file */
if ((file = fopen(original_path, "w+" )) == NULL) {
lr_output_message("Unable to create %s", filename);
return -1;
}
/* Write the Vuser id and time */
lr_whoami(&id, NULL, NULL);
fprintf(file, "Vuser %d %ld\n", id, time(&t));
/* Now read what we've just written. Rewind to start of file */
//rewind(file);
//fscanf(file, "%s", &s);
//fscanf(file, "%d", &id2);
//fscanf(file, "%ld", &thetime);
//lr_output_message("%s %d %ld", s, id2, thetime);
fprintf(file, "%s", lr_eval_string("<new_parameter>"));
fclose(file);
//lr_output_message("buffer size = %d",NumberOfBytes);
//lrs_save_param_ex("socket0", "user", ActualBuffer, 0, NumberOfBytes, "ascii", "new_parameter");
//lrs_free_buffer(ActualBuffer);
//lr_output_message("The buffer contains \"%s\"\n", lr_eval_string("<new_parameter>"));
lrs_close_socket("socket0");
return 0;
} 请问收到的数据有中文,显示为乱码,怎么转换? 顶下 不错 谢谢! 楼主的精神值得发扬
支持原创并奉献 duo谢da哥