我这样做过,先定义这样的结构
type
TCommBlock=record // the Communication Block used in both parts (Server+Client)
Command:string[20]; //ÃüÁî
myUserName:string[50]; //·ÖµêÃû³Æ
Msg:string[100];
mm:byte; // name of receiver
end;
var myCommBlock:TCommBlock;
接受:
procedure Tfrmmain.ServerUDPRead(Sender:TObject; AData:TStream;
ABinding:TIdSocketHandle);
begin
AData.ReadBuffer(myCommBlock,SizeOf(myCommBlock));
......
end;