日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Loadrunner中socket协议中的三个关联函数

發布時間:2024/4/17 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Loadrunner中socket协议中的三个关联函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這3個函數其實都可以動態獲取運行中收到的數據包中的數據,只要跟在要獲取的收取數據包腳本后面即可。其中lrs_save_searched_string和lrs_save_param如果buf_desc指明buf名稱,則從我們錄制的data.ws中獲取數據,所以每次這個值都是固定值,不會改變的;比如訂單提交的確認信息等;而如果lrs_save_searched_string和lrs_save_param參數buf_desc設置為NULL,則從腳本中每次返回的數據包中獲取數據,這個數據也隨著每次腳本的動態運行而變化,比如某個不斷遞增的ID號等。而lrs_save_param_ex 的buf_desc有3個參數,其中static指的是從我們在腳本中定義的一個靜態變量中取值,而received指的是從收到的數據包取值;而user指從data.ws文件中取值。這個一定要搞清楚。關于這個函數,這里再次提供下最原始的說明

type The type of buffer data to save into the parameter. Possible values: user - save the user data, static - save the static buffer that was originally recorded, received - save the buffer(s) received by the last call to lrs_receive. buff Depends on the type of buffer data specified in the type parameter. For user the pointer to the user buffer, For static - the descriptor of the buffer in the data file, For received the buff parameter is ignored. user:實例 char *ParamBuf = "(size=\x05)"? lrs_save_param_ex("socket0", "user", ParamBuf, 0, strlen(ParamBuf),"ascii", "size_param");? static實例 lrs_save_param_ex("socket0", "user", "buf1", 0, 23,"ascii", "param");? received實例 lrs_save_param_ex("socket0", NULL, "buf1", 0, 23,"ascii", "param");?

?


?? ??? ?---------------------------------------------------------------------------------------------------
?? ?
?? ??? ?//實例1
?? ??? ?lrs_save_searched_string("socke0","buf1","wtbh","LB/BIN=|","RB/BIN=|",2,0,-1);

?? ??? ?//輸出結果?"wtbh = 10000013" 。原始數據為"0|普通指令下達成功|10000031|"。那就是在以左邊界和右邊界第2次出現的地方,
?? ??? ?//獲取左右邊界里面的所有的值

?? ??? ?
?? ??? ?//實例2
?? ??? ?lrs_save_searched_string("socke0","buf1","wtbh","LB/BIN=|","RB/BIN=|",1,0,-1);

?? ??? ?//輸出結果"wtbh = 普通指令下達成功"原始數據為"0|普通指令下達成功|10000031|"。那就是在以左邊界和右邊界第1次出現的地方,
?? ??? ?//獲取左右邊界里面的所有的值

?? ??? ?
?? ??? ?//實例3
?? ??? ?lrs_save_searched_string("socke0","buf1","wtbh","LB/BIN=|","RB/BIN=|",1,4,-1);

?? ??? ?//輸出結果"wtbh = 指令下達成功"原始數據為"0|普通指令下達成功|10000031|"。那就是在以左邊界和右邊界第1次出現的地方,
?? ??? ?//獲取左邊界為起點的第4個字符后面的數據。

?? ??? ?
?? ??? ?//實例4
?? ??? ?lrs_save_param("socket0","buf1","wtbh", 34, 8);
?? ??? ?
?? ??? ?//從數據包中第34個字符開始連續取8個字符。
?? ??? ?
?? ??? ?//實例5
?? ??? ??? ?
?? ??? ?char * ReceivedBuffer;
?? ??? ?
?? ??? ?int iLen = 0;
?? ??? ?
?? ??? ?int iFor = 2;
?? ??? ?
?? ??? ?lrs_get_last_received_buffer("socket0", &ReceivedBuffer, &iLen);?
?? ??? ?
?? ??? ?lrs_save_param_ex("socket0", "user", ReceivedBuffer, 0, 43, "ascii", "test_para");
?? ??? ?
?? ??? ?lrs_free_buffer(ReceivedBuffer);?

?? ??? ?strZhwth = lr_eval_string("<test_para>");
?? ??? ?
?? ??? ?strZhwth = (char *)strtok(strZhwth,"|");
?? ??? ?
?? ??? ?while(iFor > 0)
?? ??? ?{
?? ??? ??? ?iFor = iFor - 1;
?? ??? ??? ?strZhwth = (char *)strtok(NULL,"|");//獲取下一個token
?? ??? ?}
?? ??? ?//通過上面的循環獲取了第2個“|”后面的字符,并且保存到strZhwth中
?? ??? ?lrs_save_param_ex("socket0", "user", strZhwth, 0, 8, "ascii", "Zhwth");?
?? ??? ?//在上面獲取字符中從第1位開始連續獲取8個字符。
?? ??? ?//函數實例6
?? ??? ?函數strtok
?? ??? ?說明Returns a token from a string delimited by specified characters.?
?? ??? ?定義char *strtok ( char *string, const char *delimiters );?
?? ??? ?參數string?The string?to?scan.? delimiters?The string consisting of the character or characters that delimit tokens in the first string.?
?? ??? ?實例
?? ??? extern char * strtok(char * string, const char * delimiters ); // Explicit declaration?
?????? char path[] = "c:\\mercury\\lrun\\bin\\wlrun.exe";?
?????? char separators[] = ".\\";?
?????? char * token;?
?????? token = (char *)strtok(path, separators); // Get the first token?
?????? if (!token) {?
????????????? lr_output_message ("No tokens found in string!");?
????????????? return( -1 );?
?????? }?
?????? while (token != NULL ) { // While valid tokens are returned?
????????????? lr_output_message ("%s", token );?
????????????? token = (char *)strtok(NULL, separators); // Get the next token?
?????? }?
?? ??? ?Output:
?? ??? ?Action.c(18):?c:
?? ??? ?Action.c(18):?mercury
?? ??? ?Action.c(18):?lrun
?? ??? ?Action.c(18):?bin
?? ??? ?Action.c(18):?wlrun
?? ??? ?Action.c(18):?exe?
?? ??? ?//函數實例7
?? ??? ?函數strstr
?? ??? ?說明Returns the first occurrence of one string in another.?
?? ??? ?定義char *strstr ( const char *string1, const char *string2 );?
?? ??? ?參數string1The string that is searched.? string2The string that is searched for in the first string. ?
?? ??? ?實例1
?? ??? ?lrs_save_param_ex("socket0", "user", ReceivedBuffer_cjhb, 0, iLenCj, "ascii", "cjhb");
?? ??? ?lrs_free_buffer(ReceivedBuffer_cjhb);?
?? ??? ?if(strstr(lr_eval_string("<cjhb>"), "已成交") != NULL)
?? ??? ?return 0;
?? ??? ?實例2
?? ??? ?After strstr returns the address, position, the code then calculates the word's place in str by subtracting the address of the start of the string from position. This is the offset of the word "dog", in bytes.?

?????? int offset;?
?????? char * position;?
?????? char * str = "The quick brown dog jumps over the lazy fox";?
?????? char * search_str = "dog";?
?????? position = (char *)strstr(str, search_str);?

?????? // strstr has returned the address. Now calculate * the offset from the beginning of str?
?????? offset = (int)(position - str + 1);?
?????? lr_output_message ("The string \"%s\" was found at position %d", search_str, offset);?
?? ??? ?Output:
?? ??? ?Action.c(14):?The string "dog" was found at position 17?

?? ??? ?//函數實例8
?? ??? ?函數strcmp
?? ??? ?說明Compares string1 and string2?to?determine the alphabetic order.
?? ??? ?定義int? ( const char *string1, const char *string2 );
?? ??? ?參數string1? The first string that is compared.? string2? The second string that is compared.strcmp compares string1 and string2?to?determine the alphabetic order.? ?
?? ??? ?實例1
?? ??? ?The following example compares two strings, string1 and string2, which are identical except for the word "quick" which is lowercase in string1 and uppercase in string2. strcmp, which is case-sensitive, returns an unequal comparison.?
?????? int result;?
?????? char tmp[20];?
?????? char string1[] = "The quick brown dog jumps over the lazy fox";?
?????? char string2[] = "The QUICK brown dog jumps over the lazy fox";?
?????? result = strcmp( string1, string2); // Case-sensitive comparison?
?????? if(result > 0)?
????????????? strcpy(tmp, "greater than");?
?????? else if(result < 0)?
????????????? strcpy(tmp, "less than");?
?????? else?
????????????? strcpy(tmp, "equal?to");?
?????? lr_output_message ("strcmp:?String 1 is %s string 2", tmp);?
?????? result = stricmp(string1, string2 ); // Case-insensitive comparison?
?????? if( result > 0 )?
????????????? strcpy( tmp, "greater than" );?
?????? else if( result < 0 )?
????????????? strcpy( tmp, "less than" );?
?????? else?
????????????? strcpy( tmp, "equal?to" );?
?????? lr_output_message( "stricmp:?String 1 is %s string 2", tmp );?
?? ??? ?Output:
?? ??? ?Action.c(17):?strcmp:?String 1 is greater than string 2
?? ??? ?Action.c(28):?stricmp:?String 1 is equal?to?string 2?

?? ??? ?單詞descriptor identifying?標識符描述

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Loadrunner中socket协议中的三个关联函数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产区精品区 | 久久亚洲av成人无码国产电影 | 久婷婷 | 成人激情视频网 | 欧美黄色一级 | 美女高潮视频在线观看 | 日韩免费在线看 | 337p日本欧洲亚洲大胆精筑 | 日韩综合第一页 | 日本一道本在线 | 亚洲调教| 国产乱码一区二区三区在线观看 | 天堂资源 | 小视频国产 | 国产在线超碰 | 91久操 | 国产精品外围 | 玩偶游戏在线观看免费 | 91视频免费在线 | 超碰成人av| 人与动物黄色片 | 欧美一区二区三区免费观看 | 丰满女邻居的色诱4hd | 欧美日韩精品久久久免费观看 | 久久久精品综合 | 又污又黄又爽的网站 | 九九热视频精品在线观看 | 91亚洲国产成人久久精品麻豆 | aa视频在线 | 亚洲成a人片77777kkkk | 欧美性猛交xxx乱久交 | 男人天堂av电影 | 69av在线视频 | 黄色小视频在线观看免费 | 伊人色在线 | 午夜免费成人 | 国产精品三区四区 | 一级特黄色 | 成年人久久 | 日本强好片久久久久久aaa | 91av免费看 | 激情五月视频 | 国产精品一区二区无线 | 男男受被啪到高潮自述 | 少妇做爰免费理伦电影 | 久久777 | 91最新入口 | 亚洲成人xxx| 草逼视频免费看 | 黄色一级片国产 | 欧美成年人网站 | 白白色视频在线 | 国产精品一区二区久久国产 | 亚洲一区二区三区香蕉 | 欧美日韩成人在线播放 | 720url在线观看免费版 | 亚洲综合一区二区 | 欧美操大逼 | 黄色视屏在线看 | 日本一区二区三区精品 | 爱情岛黄色 | 国产一区欧美二区 | 麻豆av电影在线 | 久久综合九色综合欧美狠狠 | 99ri国产精品| 色综网| 免费黄色一级大片 | 日本视频中文字幕 | 精品人妻少妇一区二区 | 欧美性猛交乱大交3 | 国产中文字幕二区 | 国产九色sp调教91 | 天堂8在线| av免费看网址 | 国产亚洲在线观看 | 美女光屁屁露胸胸 | 成人在线视频网址 | 熟女少妇内射日韩亚洲 | 大陆农村乡下av | 日日噜夜夜噜 | 亚洲a视频在线 | 性色欲情网站iwww九文堂 | 夫妻性生活黄色片 | 国产精品久久久久久久一区二区 | 三级网站在线看 | 国久久 | 快色在线| 女女同性女同一区二区三区九色 | 国产精品污www在线观看 | 96精品国产 | 欧美日韩成人在线播放 | 亚洲欧美日韩中文在线 | 一本久久综合亚洲鲁鲁五月天 | 色综合图片区 | 性爱免费视频 | 毛片av网站 | 男人的天堂97 | 久久神马| 国产美女www爽爽爽 www.国产毛片 |