wistaria 发表于 2008-11-12 11:04:39

lrs_get_user_buffer_size 参数问题!

Action()
{
    long BufSize;
    lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=Summer:3000", LrsLastArg);
    lrs_send("socket0", "buf0", LrsLastArg);
    BufSize = lrs_get_user_buffer_size ("socket0");//参数错误,该如何写参数呢?
    lr_output_message("Size是:%d",BufSize); // 结果为Size 是:0
    lr_output_message("Buf 内容是:%s",lrs_get_user_buffer ("socket0"));//为空Buf 内容是:
    return 0;
}
该如何获得Buffer的内容呢?
lrs_get_user_buffer_size 、lrs_get_user_buffer 参数该如何设置?

iori 发表于 2008-11-12 13:50:31

给你一个例子:
char *UserBuf, *StrToLog;

int LenOfUserBuf;

lrs_get_static_buffer("socket1", "buf10", 0, -1, NULL);

UserBuf = lrs_get_user_buffer("socket1");

LenOfUserBuf = lrs_get_user_buffer_size("socket1");

StrToLog = (char*)malloc(LenOfUserBuf + 1);

/* Copy user buffer and skip two unprintable characters at the beginning */

strncpy(StrToLog, UserBuf+2, LenOfUserBuf-2);

lr_output_message("UserBuf = \"%s\"", StrToLog);

lr_output_message("The buffer size = \"%d\"", LenOfUserBuf);

The output generated by the above code, as seen in the VuGen Execution log is:

Message from run.c(52): UserBuf = "X-AUTHENTICATION-1"

Message from run.c(52): The buffer size = 20

wistaria 发表于 2008-11-12 14:42:43

o(∩_∩)o...!谢谢。不过那个偏移量的怎么算的呢?

wistaria 发表于 2008-11-12 14:44:43

这里面如何算我需要的偏移量
页: [1]
查看完整版本: lrs_get_user_buffer_size 参数问题!