First, select the windows sockets protocol
Action()
{ lr_save_string(lr_eval_string("<socketid>"),"socket_num");//For the convenience of parameterization, the parameterized content is stored in an ordinary function at the beginning lr_start_transaction("test" );
lrs_create_socket(lr_eval_string("<socket_num>"),"TCP","LocalHost=0","RemoteHost=127.0.0.1:8899",LrsLastArg);
lrs_send(lr_eval_string("<socket_num>"), "buf0", LrsLastArg); //Send the data in "buf0" to "tt"
lrs_set_recv_timeout(10, 0);//Set here to return a timeout of 10 seconds
lrs_receive(lr_eval_string("<socket_num>"), "buf1", LrsLastArg);//Store the data returned in "tt" in "buf1"
//Note that the length of buf1 needs to be adjusted here to adapt to the actual business data
lrs_save_param(lr_eval_string("<socket_num>"), NULL, "jy", 0, 2);
if(strcmp(lr_eval_string("<jy>"),"ok")==0)
{
lr_output_message("成功,交易响应码: %s",lr_eval_string("<jy>"));
lr_end_transaction("test", LR_PASS);
}
else
{ lr_output_message("Failure, transaction response code: %s",lr_eval_string("<jy>")); lr_end_transaction("test", LR_FAIL);
}
lrs_close_socket(lr_eval_string("<socket_num>"));
return 0;
}
The parameterization of <socketid> is tt
You need to use the socketTool tool to simulate the server proxy. You can go online and download it.