我用array of char 接收不到数据,而array[0..2] of char可以,这是为什么?
程序如下:
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
RecData :array of char;
RecLen: integer;
i:integer;
s:string;
begin
RecLen:= Socket.ReceiveLength;
setLength(RecData,RecLen) ;
socket.Receivebuf(RecData,Socket.ReceiveLength);
s:='';
for i:=0 to RecLen-1 do s:=s+inttohex(ord(recdata),2)+ ' ';
memo1.Lines.Add(s);
end;