H
hzjzxp
Unregistered / Unconfirmed
GUEST, unregistred user!
type Tpacket=record
mode:integer;
ConWord:string[4];
array_str:array of string;
end;
发送代码
var
sendpacket:Tstpacket;
len:integer;
begin
sendpacket.mode:=0;
setlength(sendpacket.array_str,2);
sendpacket.array_str[0] := 'h';
sendpacket.ConWord[0] := '1234';
len:=sizeof(sendpacket);
IdUDPClient1.SendBuffer(sendpacket,len);
end;
在IdUDPServer1UDPRead
var
revpack:Tstpacket;
begin
adata.ReadBuffer(revpack,adata.size);
showmessage(revpack.array_str[0]);
end;
显示空白,不知道为什么, 当array_str:array of string;为array_str:array of [0..2]string;为静态数组是可以收到!
想问一下UDP的动态数据是这样实现的.
mode:integer;
ConWord:string[4];
array_str:array of string;
end;
发送代码
var
sendpacket:Tstpacket;
len:integer;
begin
sendpacket.mode:=0;
setlength(sendpacket.array_str,2);
sendpacket.array_str[0] := 'h';
sendpacket.ConWord[0] := '1234';
len:=sizeof(sendpacket);
IdUDPClient1.SendBuffer(sendpacket,len);
end;
在IdUDPServer1UDPRead
var
revpack:Tstpacket;
begin
adata.ReadBuffer(revpack,adata.size);
showmessage(revpack.array_str[0]);
end;
显示空白,不知道为什么, 当array_str:array of string;为array_str:array of [0..2]string;为静态数组是可以收到!
想问一下UDP的动态数据是这样实现的.