lr中winsock协议的脚本(转载51testing)
winsock协议代码
Actions()
{
char acTest[100];
char acTest2[100];
char* pcTest3;
//生成发送的串
sprintf(acTest,"kkkhhhh\r\n";
//指定发送的串
lrs_set_send_buffer ("socket0", acTest, strlen(acTest));
//发送,由于之前运行了lrs_set_send_buffer,所以这里的"buf0"参数无效
lrs_send("socket0", "buf0", LrsLastArg);
//接收返回的串
lrs_receive("socket0", "buf1", LrsLastArg);
//把返回的串放到变量中
pcTest3=lrs_get_received_buffer ("socket0", 0, -1, NULL);
//对返回串中的数据操作
if (pcTest3[0]=='k')
{
lrs_set_send_buffer ("socket0", pcTest3, strlen(pcTest3));
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
}
Actions()
{
char acTest[100];
char acTest2[100];
char* pcTest3;
//生成发送的串
sprintf(acTest,"kkkhhhh\r\n";
//指定发送的串
lrs_set_send_buffer ("socket0", acTest, strlen(acTest));
//发送,由于之前运行了lrs_set_send_buffer,所以这里的"buf0"参数无效
lrs_send("socket0", "buf0", LrsLastArg);
//接收返回的串
lrs_receive("socket0", "buf1", LrsLastArg);
//把返回的串放到变量中
pcTest3=lrs_get_received_buffer ("socket0", 0, -1, NULL);
//对返回串中的数据操作
if (pcTest3[0]=='k')
{
lrs_set_send_buffer ("socket0", pcTest3, strlen(pcTest3));
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
}