51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4902|回复: 21
打印 上一主题 下一主题

[原创] 在线急求解决winsock录制和执行的问题?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2005-1-19 10:48:30 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
测试对象:在C/S结构,TCP/IP协议 ,利用客户端对服务器端进行压力测试
服务器端:采用SQL server数据库
客户端:采用SQL server数据库,程序调用自定义的dll文件(对winsock api打包的文件)。采用MS SQL server协议录制脚本没有代码,因此采用windows sockets协议录制。
录制代码如下:

vuser_init()
{
    lrs_startup(257);

    lrs_create_socket("socket0", "TCP", "LocalHost=2404", "Backlog=5",  LrsLastArg);

    lrs_create_socket("socket1", "TCP",  LrsLastArg);

    lrs_send("socket1", "buf0", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf1", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf2", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf3", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf4", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf5", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf6", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf7", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf8", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf9", LrsLastArg);

    lrs_receive("socket1", "buf10", LrsLastArg);

    lrs_send("socket1", "buf11", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf12", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf13", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf14", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf15", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf16", LrsLastArg);

    lrs_receive("socket1", "buf17", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf18", LrsLastArg);

    lrs_receive("socket1", "buf19", LrsLastArg);

    lrs_send("socket1", "buf20", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf21", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf22", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf23", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf24", LrsLastArg);

    lr_think_time(2);

    lrs_send("socket1", "buf25", LrsLastArg);

    lr_think_time(2);

    lrs_close_socket("socket1");

    lrs_close_socket("socket0");

    return 0;
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏

该用户从未签到

22#
发表于 2011-8-5 14:47:28 | 只看该作者
这个问题我关注很久了 为什么还没有解决。高手出来帮下忙啦。
回复 支持 反对

使用道具 举报

  • TA的每日心情
    奋斗
    2018-2-28 18:04
  • 签到天数: 40 天

    连续签到: 1 天

    [LV.5]测试团长

    21#
    发表于 2010-8-19 10:39:58 | 只看该作者
    ....最好是能看到数据,socket中的数据可能需经过翻译才能看到。。。。抓狂。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    20#
    发表于 2010-8-19 10:09:59 | 只看该作者
    这个问题我也遇到了,谁解答下
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    19#
    发表于 2006-7-6 11:22:26 | 只看该作者
    没有人说话了

    [ 本帖最后由 view999 于 2006-7-6 14:34 编辑 ]
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    18#
    发表于 2006-7-6 11:20:44 | 只看该作者
    希望有经验的人进来讨论讨论
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    17#
    发表于 2006-7-6 10:11:40 | 只看该作者
    数据不匹配 ,也是有可能啊,你也提醒了我。

    但是现实是我没办法看到服务器的数据,整套软件我们的外包公司还没有提交给我们,这时候你要查看服务器,他不会同意的。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    16#
    发表于 2006-7-6 10:08:46 | 只看该作者
    哦,那你看看你录制的时候,服务器有没有报错。是不是数据不匹配。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    15#
    发表于 2006-7-6 10:03:32 | 只看该作者

    我个人的看法

    以前我测试过上海金仕达的期货软件,录制,测试都非常成功,我想可能金仕达可能是用socket1写的软件。
    现在我测得软件是用socket2写的,我个人认为是不是loadrunner对socket2支持的不够好?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    14#
    发表于 2006-7-6 10:00:44 | 只看该作者

    这是我的 record log

    /* WSAStartup(): process 1636 using flags 0 */

    /* ReadCommWindowInfo: HttpInterceptMode = 0 */

    /* socket(): created with handle: 1636:324, address format 2, type 2, protocol 0. */

    /* setsockopt(): socket 1636:324, level: 0xffff, optname: 0x4, optval: 1 */

    /* lr_think_time(): wait 12 seconds */

    /* bind(): socket 1636:324 bound with family 2, port 9010, and address 0x0 */

    /* setsockopt(): socket 1636:324, level: 0x0, optname: 0xa, optval: 8 */

    /* setsockopt(): socket 1636:324, level: 0x0, optname: 0xb, optval: 1 */

    /* setsockopt failed */

    /* setsockopt(): socket 1636:324, level: 0xffff, optname: 0x1006, optval: 0 */

    /* setsockopt(): socket 1636:324, level: 0xffff, optname: 0x1005, optval: 0 */

    /* lr_think_time(): wait 10 seconds */

    /* socket(): created with handle: 1636:640, address format 2, type 1, protocol 6. */

    /* connect(): socket 1636:640 tried to connect with family 2, port 9002, and address 0xc0a80097. Return value: -1 */

    /* setsockopt(): socket 1636:640, level: 0x6, optname: 0x1, optval: 1 */

    /* setsockopt(): socket 1636:640, level: 0xffff, optname: 0x80, optval: 1 */

    /* setsockopt(): socket 1636:640, level: 0xffff, optname: 0x1006, optval: 0 */

    /* setsockopt(): socket 1636:640, level: 0xffff, optname: 0x1005, optval: 0 */

    /* send(): 13 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 29 bytes were received from socket 1636:640 using flags 2 (1024 were asked for) */

    /* recv(): 29 bytes were received from socket 1636:640 using flags 0 (29 were asked for) */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 51 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 145 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 91 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 106 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 91 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 356 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* recv(): 62 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 74 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 61 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 55 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 88 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 72 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 81 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 55 bytes were sent to socket 1636:640 using flags 0 */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 81 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 700 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* recv(): 3123 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv(): 168 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 68 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 733 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* recv(): 324 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 73 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 82 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 75 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 63 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 81 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 470 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* recv(): 63 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 57 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 2244 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* lr_think_time(): wait 8 seconds */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 68 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 82 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 126 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 84 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 68 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 82 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */

    /* Error -   WSPsend: asynchronous send call */

    /* send(): 126 bytes were sent to socket 1636:640 using flags 0 */

    /* recv(): 84 bytes were received from socket 1636:640 using flags 0 (4096 were asked for) */

    /* recv failed */
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    13#
    发表于 2006-7-6 10:00:02 | 只看该作者

    这是我的录制脚本

    /*********************************************************************
    * Created by Mercury Interactive Windows Sockets Recorder
    *
    * Created on: Thu Jul 06 08:45:05
    *********************************************************************/

    #include "lrs.h"


    vuser_init()
    {
        lrs_startup(257);

        lr_think_time(12);

        lr_think_time(10);

        lrs_create_socket("socket0", "TCP", "RemoteHost=COMPUTER1:9002",  LrsLastArg);

        lrs_send("socket0", "buf0", LrsLastArg);

        lrs_receive("socket0", "buf1", LrsLastArg);

        lrs_send("socket0", "buf2", LrsLastArg);

        lrs_receive("socket0", "buf3", LrsLastArg);

        lrs_send("socket0", "buf4", LrsLastArg);

        lrs_receive("socket0", "buf5", LrsLastArg);

        lrs_send("socket0", "buf6", LrsLastArg);

        lrs_receive("socket0", "buf7", LrsLastArg);

        lrs_send("socket0", "buf8", LrsLastArg);

        lrs_receive("socket0", "buf9", LrsLastArg);

        lrs_send("socket0", "buf10", LrsLastArg);

        lrs_receive("socket0", "buf11", LrsLastArg);

        lrs_send("socket0", "buf12", LrsLastArg);

        lrs_receive("socket0", "buf13", LrsLastArg);

        lrs_send("socket0", "buf14", LrsLastArg);

        lrs_receive("socket0", "buf15", LrsLastArg);

        lrs_send("socket0", "buf16", LrsLastArg);

        lrs_receive("socket0", "buf17", LrsLastArg);

        lrs_send("socket0", "buf18", LrsLastArg);

        lrs_receive("socket0", "buf19", LrsLastArg);

        lrs_send("socket0", "buf20", LrsLastArg);

        lrs_receive("socket0", "buf21", LrsLastArg);

        lrs_send("socket0", "buf22", LrsLastArg);

        lrs_receive("socket0", "buf23", LrsLastArg);

        lrs_send("socket0", "buf24", LrsLastArg);

        lrs_receive("socket0", "buf25", LrsLastArg);

        lr_think_time(8);

        lrs_send("socket0", "buf26", LrsLastArg);

        lrs_receive("socket0", "buf27", LrsLastArg);

        lrs_send("socket0", "buf28", LrsLastArg);

        lrs_receive("socket0", "buf29", LrsLastArg);

        lrs_send("socket0", "buf30", LrsLastArg);

        lrs_receive("socket0", "buf31", LrsLastArg);

        lrs_send("socket0", "buf32", LrsLastArg);

        lrs_receive("socket0", "buf33", LrsLastArg);

        return 0;
    }
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    12#
    发表于 2006-7-6 09:55:45 | 只看该作者
    刚才看了下你建立了socket0,之后的代码没有再涉及到它,是否是无用代码,注释掉它。还需把lrs_close_socket("socket0");
    也一起注释掉,要不会出语法错误
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    11#
    发表于 2006-7-6 09:43:34 | 只看该作者
    data.ws 的数据没有动 ,问题是录制脚本的时候就出现了问题,可以在record log里看到这样的错误
    * recv(): 29 bytes were received from socket 1636:640 using flags 0 (29 were asked for) */

    /* Error -   WSPsend: asynchronous send call */

    我测试的程序是winsock2写的三层结构的客户端,类似股票交易软件
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    10#
    发表于 2006-7-6 09:35:51 | 只看该作者
    打开你的data.ws文件,看看你的数据,是不是一直使用录制时的参数,比如用户名等需要参数化,还有如流水号等 需要关联。如果 执行了参数化,那么看看 你的取值是否正确
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    9#
    发表于 2006-7-6 09:22:11 | 只看该作者
    有解决方案的分享一下经验,哈哈 我也遇到了这个问题.
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    8#
    发表于 2006-7-6 09:21:16 | 只看该作者
    这个问题怎么还没有解决阿?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7#
    发表于 2005-7-29 08:45:47 | 只看该作者
    是数据包没有接收到,需要查看所接收的buf的内容,确定其中的数据,在根据业务判断这些数据参数是否符合业务的要求
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    6#
    发表于 2005-7-21 16:09:48 | 只看该作者

    同样的困惑:

    具体表现是客户端发送的数据服务器端接收不到
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
     楼主| 发表于 2005-1-19 10:54:38 | 只看该作者
    录制日志中:
    09:57:33.375 /* Error -   WSPrecv: asynchronous receive call */

    09:57:33.375 /* recv failed */

    09:57:35.203 /* lr_think_time(): wait 2 seconds */

    09:57:35.218 /* Error -   WSPrecv: asynchronous receive call */

    09:57:35.218 /* Error -   WSPsend: asynchronous send call */

    09:57:35.218 /* recv failed */

    执行日志:

    vuser_init.c(56): Mismatch (expected 16 bytes, 0 bytes actually received)


    这些问题不知道怎么解决,请兄弟姐妹指点迷津!
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
     楼主| 发表于 2005-1-19 10:51:44 | 只看该作者
    executing log:

    Virtual User Script started
    Starting action vuser_init.
    vuser_init.c(12): lrs_startup(257)
    vuser_init.c(14): lrs_create_socket(socket0, TCP, ...)
    vuser_init.c(16): lrs_create_socket(socket1, TCP, ...)
    vuser_init.c(18): lrs_send(socket1, buf0)
    vuser_init.c(22): lrs_send(socket1, buf1)
    vuser_init.c(26): lrs_send(socket1, buf2)
    vuser_init.c(30): lrs_send(socket1, buf3)
    vuser_init.c(34): lrs_send(socket1, buf4)
    vuser_init.c(38): lrs_send(socket1, buf5)
    vuser_init.c(42): lrs_send(socket1, buf6)
    vuser_init.c(46): lrs_send(socket1, buf7)
    vuser_init.c(50): lrs_send(socket1, buf8)
    vuser_init.c(54): lrs_send(socket1, buf9)
    vuser_init.c(56): lrs_receive(socket1, buf10)
    vuser_init.c(56): Mismatch (expected 16 bytes, 0 bytes actually received)
    vuser_init.c(58): lrs_send(socket1, buf11)
    vuser_init.c(62): lrs_send(socket1, buf12)
    vuser_init.c(66): lrs_send(socket1, buf13)
    vuser_init.c(70): lrs_send(socket1, buf14)
    vuser_init.c(74): lrs_send(socket1, buf15)
    vuser_init.c(78): lrs_send(socket1, buf16)
    vuser_init.c(80): lrs_receive(socket1, buf17)
    vuser_init.c(80): Mismatch (expected 66 bytes, 0 bytes actually received)
    vuser_init.c(84): lrs_send(socket1, buf18)
    vuser_init.c(86): lrs_receive(socket1, buf19)
    vuser_init.c(86): Mismatch (expected 16 bytes, 0 bytes actually received)
    vuser_init.c(88): lrs_send(socket1, buf20)
    vuser_init.c(92): lrs_send(socket1, buf21)
    vuser_init.c(96): lrs_send(socket1, buf22)
    vuser_init.c(100): lrs_send(socket1, buf23)
    vuser_init.c(104): lrs_send(socket1, buf24)
    vuser_init.c(108): lrs_send(socket1, buf25)
    vuser_init.c(112): lrs_close_socket(socket1)
    vuser_init.c(114): lrs_close_socket(socket0)
    Ending action vuser_init.
    Running Vuser...
    Starting iteration 1.
    Starting action Action.
    Ending action Action.
    Ending iteration 1.
    Ending Vuser...
    Starting action vuser_end.
    vuser_end.c(12): lrs_cleanup()
    Ending action vuser_end.
    Vuser Terminated.
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-10 22:23 , Processed in 0.089839 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表