08-29-2018, 11:43 AM
OK, this is great. I've been struggling and had arrive at a similar method to send a byte array... thinking I had failed I vasilate between trying Indy & the old reliable Piette's sockets but I want to use Indy- then suddenly my example streamed a response so there is hope. unfortunately I am a struggling newbie to Indy and an intermediate Delphi guy.
I created a dynamic array;
TxBuffer : TIdBytes;
Sized it;
SetLength(TxBuffer,6);
I loaded it with pointers, I see now I didn't have to do that anyway...
I sent the bytes like this but I don't think it's right?:
IdTCPClient.IOHandler.Write(@TxBuffer[0],7);
I need to receive a byte array. The protocol is a lightweight datalink protocol, framed by simple headers (Start of Frame byte, inverted payload length, payload length, (Payload is a packed record structure of bytes and words, then an array of words) followed by two bytes of the 'Modbus' CRC, which I am calculating fine.
Could someone please give me a starting point for the IOHandler to receive a buffer of bytes? It's not big, about 46 bytes right now though it will be bigger. Ultimately it will stream at a fair speed for monitoring the data.
I created a dynamic array;
TxBuffer : TIdBytes;
Sized it;
SetLength(TxBuffer,6);
I loaded it with pointers, I see now I didn't have to do that anyway...
I sent the bytes like this but I don't think it's right?:
IdTCPClient.IOHandler.Write(@TxBuffer[0],7);
I need to receive a byte array. The protocol is a lightweight datalink protocol, framed by simple headers (Start of Frame byte, inverted payload length, payload length, (Payload is a packed record structure of bytes and words, then an array of words) followed by two bytes of the 'Modbus' CRC, which I am calculating fine.
Could someone please give me a starting point for the IOHandler to receive a buffer of bytes? It's not big, about 46 bytes right now though it will be bigger. Ultimately it will stream at a fair speed for monitoring the data.