Warum machst du es nicht gleich so und nimmst gleich das Array zum Übertragen?
Delphi-Quellcode:
procedure TForm7.Button1Click(Sender: TObject);
var data: TBytes; //Array of Byte;
i: integer;
begin
setlength(data, length(Edit3.Text) + 14);
// ReqSize
data[0] := length(Edit3.Text) + 10;
data[1] := 0;
data[2] := 0;
data[3] := 0;
// ReqID
data[4] := 0;
data[5] := 0;
data[6] := 0;
data[7] := 0;
// ReqType
data[8] := 3;
data[9] := 0;
data[10] := 0;
data[11] := 0;
// ReqBody
for i := 1 to length(Edit3.Text) do
data[11 + i] := TEncoding.Default.GetBytes(Edit3.Text[i])[0];
// Null Terminator Body
data[High(data) - 1] := 0;
// Null Terminator Req
data[High(data)] := 0;
IdTCPClient1.IOHandler.Write(data);
end;