Hello,
I am sending a bunch of rawbytes via sockets. I am trying to get the number of bytes (i.e. length of message in bytes) and send them at the beginning of the data. This is a snippet of my code:
VAR rawbytes message;
ClearRawBytes message\FromIndex:=1;
PackRawBytes sync,message,(RawBytesLen(message)+1)\INTX:=UDINT;
PackRawBytes messagenum,message,(RawBytesLen(message)+1)\INTX:=UDINT;
…
lengthmsg:=RawBytesLen(message)+4;
Slengthmsg:=" Message length,"+ValToStr(lengthmessage);
PackRawBytes slengthmessage,message,(RawBytesLen(message)+1)\ASCII;
SocketSend client_socket\RawData:=message;
How can I index the array (message) such that the length of the data is at the beginning of the message instead of at the end?
Thanks for any help,
SM