zoukankan      html  css  js  c++  java
  • loadrunner winsocket 编程实例

    针对公司平台的一个winsocket代码,期间遇到了打印字符串出错,100054错误,前一种主要是通过lr_eval_string()转换得出值,后一个主要是通过加一个lrs_close_socket();解决

     
    char *ActualBuffer;
    int NumberOfBytes;
    char * position;
    char * str;
    char * search_str;
     
    //lrs_set_connect_timeout(100,0);
    lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=", LrsLastArg);
     
    //lrs_set_connect_timeout(50,0);
    lrs_send("socket0", "bufTest", LrsLastArg);
     
    lrs_receive("socket0", "bufRecv", LrsLastArg);
    lrs_get_last_received_buffer("socket0", &ActualBuffer, &NumberOfBytes);
    lrs_save_param_ex("socket0", "user", ActualBuffer, 0, 500, "ascii", "new_parameter");
    //lr_output_message("new_parameter = \"%s\"\n", lr_eval_string("{new_parameter}"));
     
    //lr_output_message("The last buffer's is:%c/n", lr_eval_string("{ActualBuffer}"));
     
     
    search_str=lr_eval_string("{name}");
    //lr_output_message("name is %s",lr_eval_string("{name}"));
     
    position = (char *)strstr(lr_eval_string("{new_parameter}"), search_str);
    if (position) {
    lr_output_message("you are here==========================+++++++++++++++++++++++++++++++");
    lr_output_message("name is %s",lr_eval_string("{name}"));
    lr_output_message("name is %s",lr_eval_string("{pwd}"));
    lr_output_message("you are here==========================+++++++++++++++++++++++++++++++");
     
    }
    lrs_close_socket("socket0");
  • 相关阅读:
    洛谷 P1226 【模板】快速幂||取余运算 题解
    洛谷 P2678 跳石头 题解
    洛谷 P2615 神奇的幻方 题解
    洛谷 P1083 借教室 题解
    洛谷 P1076 寻宝 题解
    洛谷 UVA10298 Power Strings 题解
    洛谷 P3375 【模板】KMP字符串匹配 题解
    Kafka Shell基本命令
    Mybatis与Hibernate的详细对比
    MyBatis简介
  • 原文地址:https://www.cnblogs.com/zthua/p/2853338.html
Copyright © 2011-2022 走看看