#include "module1.h" char testbuf[]={ 0,0,0,0,0,5,1,3,2,0x1A,0xB9 }; int VcomCmdModbus(TCPREADDATA *p) { /* VCOM3001 or later will call this function for port 9999. when socket from TCP PORT 9999 will call this function. user can get the following message: p->ReadUartChar : the buffer store the command data. p->Length : the command data length. p->Socket : the socket number that receive the command, that is when the user function want return message to the client, just use the socket to send data. use: VcomSendSocket(p->Socket,pdata,datalength); */ /* here just send back the command come from port 9999. */ if(p->Length==12){ // 00 00 00 00 00 06 01 03 00 00 00 01 VcomSendSocket(p->Socket,testbuf,11); } else VcomSendSocket(p->Socket,p->ReadUartChar,p->Length); }