M
marco_hsu
Unregistered / Unconfirmed
GUEST, unregistred user!
用IdUDPServer1连续接收发来的信息,为何隔一段时间后就不可以了?非要关闭窗体重新开一下才行:
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
astringstream:tstringstream;
tpstring:string;
begin
//if memo1.Lines.Count = 0 then
// begin
astringstream:=tstringstream.Create('');
astringstream.CopyFrom(AData, AData.Size);
tpstring := astringstream.DataString;
MEMO1.Lines.Add(tpstring);
astringstream.Free;
if Application.FindComponent('Form2') = nil then
begin
form2 := Tform2.Create(Application);
form2.Showmodal;
form2.free;
end;
end;
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
var
astringstream:tstringstream;
tpstring:string;
begin
//if memo1.Lines.Count = 0 then
// begin
astringstream:=tstringstream.Create('');
astringstream.CopyFrom(AData, AData.Size);
tpstring := astringstream.DataString;
MEMO1.Lines.Add(tpstring);
astringstream.Free;
if Application.FindComponent('Form2') = nil then
begin
form2 := Tform2.Create(Application);
form2.Showmodal;
form2.free;
end;
end;