Read TCP message with CAPL

Viewed 49

I am trying to read a message via TCP.

variables
{
  dword serverIpAddress = 0x0101A8C0;  
  dword serverPort    = 502;           
  dword clientIpAddress = 0x0201A8C0;  
  dword size = 2;
  int varRead_AI;
  char Read_AI_receive[1024];
  long Read_AI_TCP;
  long result_Read_AI;
  
  byte Read_AI[12]= {0,0,0,0,0,6,1,3,0,1,0,0};
}


TcpSend(gConnectionSocket,Read_AI,elcount(Read_AI)); // send the request   
// void OnTcpReceive( dword socket, long result, dword address, dword port, char buffer[], dword size)
void OnTcpReceive(dword gConnectionSocket, long result_Read_AI, dword serverIpAddress, dword serverPort, char Read_AI_receive[], dword size)
{
   write("result_Read_AI: %d",result_Read_AI);
}
  

Which values do I have to give the function and does the function returns the result (in the varible result) for every TCP message which comes in?

0 Answers
Related