/********************************************************************* * Created by Mercury Interactive Windows Sockets Recorder * * Created on: Fri Jul 13 16:08:19 *********************************************************************/ #include "lrs.h" vuser_init() { lrs_startup(257); lr_start_transaction("create_socket"); lrs_create_socket("socket0", "TCP", "RemoteHost=127.0.0.1:110", LrsLastArg); lr_end_transaction("create_socket", LR_AUTO); return0; } /********************************************************************* * Created by Mercury Interactive Windows Sockets Recorder * * Created on: Fri Jul 13 16:08:19 *********************************************************************/ #include "lrs.h"long getNextRecvLen(char* socketID) { int NumberOfBytes = 0; int NextRecvLen = 0; char *Buffer; lrs_get_last_received_buffer(socketID, &Buffer, &NumberOfBytes); memcpy((char*)&NextRecvLen, Buffer+20, 4); lr_log_message("last_received:%d, NextRecvLen:%d", NumberOfBytes, NextRecvLen); return NextRecvLen; } int receive_ex(char* socketID, char* buf) { long NextRecvLen = getNextRecvLen(socketID);//getNextRecvLen("socket0");char flag[50]; memset(flag, 0, sizeof(flag)); sprintf(flag, "NumberOfBytesToRecv=%d", NextRecvLen); lr_log_message(flag); lrs_receive_ex(socketID, buf, flag, LrsLastArg); } void doOneThing(int index) { char sendbuf[50]; char recvbuf1[50]; char recvbuf2[50]; char transbuf[50]; memset(transbuf, 0, sizeof(transbuf)); sprintf(transbuf, "one_send_recv_%d", index); lr_start_transaction(transbuf); memset(sendbuf, 0, sizeof(sendbuf)); memset(recvbuf1, 0, sizeof(recvbuf1)); memset(recvbuf2, 0, sizeof(recvbuf2)); sprintf(sendbuf, "buf%d", 2*index); sprintf(recvbuf1, "buf%d", 2*index+1); sprintf(recvbuf2, "dbuf%d", index); lrs_send("socket0", sendbuf, LrsLastArg); lrs_receive_ex("socket0", recvbuf1, "NumberOfBytesToRecv=32", LrsLastArg); receive_ex("socket0", recvbuf2); lr_end_transaction(transbuf, LR_AUTO); } Action() { lr_rendezvous("read_all_req_0"); doOneThing(0); } |