G
glede
Unregistered / Unconfirmed
GUEST, unregistred user!
客户端发一次数据,不晓得服务端的Execute事件为何会触发两次(第二次还是个异常)?
请赐教,代码如下:
客户端代码:
procedure TfrmClient.Button1Click(Sender: TObject);
begin
IdTCPClient1.Connect;
IdTCPClient1.Write('Test'+#0);
IdTCPClient1.Disconnect;
end;
服务端代码:
procedure TfrmServer.IdTCPServer1Execute(AThread: TIdPeerThread);
var
s:string;
begin
try
s:=AThread.Connection.ReadLn(#0);
ShowMessage(s);
except on e:exception do
ShowMessage(e.Message);
end;
end;
请赐教,代码如下:
客户端代码:
procedure TfrmClient.Button1Click(Sender: TObject);
begin
IdTCPClient1.Connect;
IdTCPClient1.Write('Test'+#0);
IdTCPClient1.Disconnect;
end;
服务端代码:
procedure TfrmServer.IdTCPServer1Execute(AThread: TIdPeerThread);
var
s:string;
begin
try
s:=AThread.Connection.ReadLn(#0);
ShowMessage(s);
except on e:exception do
ShowMessage(e.Message);
end;
end;