/********************************************************************* * Created by Mercury Interactive Windows Sockets Recorder * * Created on: Tue Nov 12 14:51:33 *********************************************************************/ #include "lrs.h" Action() { int NumberOfBytes=0; char *ActualBuffer; unsigned char num1,num2,num3,num4; unsigned int jifen =0; int dj =0 ; char * tmp; int i=0; lrs_create_socket("socket0", "TCP", "RemoteHost=10.15.107.12:12345", LrsLastArg); lrs_send("socket0", "buf0", LrsLastArg); lrs_receive("socket0", "buf1", LrsLastArg); /* Get the last received buffer and its size. */ lrs_get_last_received_buffer("socket0", &ActualBuffer, &NumberOfBytes); //7B 9C 0B 00 00 0F 00 02 6C 00 00 00 08 00 90 5F 01 00 0D 00 00 00,从第偏移量17取数,直到14,作为积分;偏移量18为等级。 lr_output_message("The last buffer's size is:%d/n", NumberOfBytes); num1 = ActualBuffer[17]; //最高位 num2 = ActualBuffer[16]; num3 = ActualBuffer[15]; num4 = ActualBuffer[14]; //最低位 lr_output_message("num1 = %d,num2 = %d,num3 = %d,num4 = %u\n",num1,num2,num3,num4); jifen = (num1 / 16 ) * 268435456 + (num1 % 16)* 16777216 + (num2 / 16)* 1048576 +(num2 % 16) * 65536 +(num3 / 16) * 4096 + (num3 % 16 ) * 256 +(num4 / 16)* 16 + (num4 % 16) * 1; //注意00 90 5F 01是16进制格式,其中01(num1)是最高位。 dj=(int)ActualBuffer[18]; lrs_free_buffer(ActualBuffer); lr_output_message("jifen = %d\n",jifen ); lr_output_message("dj = %d\n",dj ); lrs_close_socket("socket0"); return 0; } vuser_end.c [cpp] view plaincopy #include "lrs.h" vuser_end() { lrs_cleanup(); return 0; } |