怎么样是tidcpserver的execute事件,不是一直在执行?

laodiao 2003-11-11 08:59:04
我的程序是这样设想的,当有设置来连接我的计算机的时候,我就给它发送一个命令,但是发完之后,tidcpserver的execute的事件一直在执行?

我的程序如下:该怎么样去修改。。
procedure TFrm_Main.TcpServerConnect(AThread: TIdPeerThread);
var
Client : TSimpleClient;
begin
Client := TSimpleClient.Create;
Client.DNS := AThread.Connection.Socket.Binding.PeerIP;
Client.Name := 'Logging In';
Client.ListLink := lbClients.Items.Count;
Client.Thread := AThread;
lbClients.Items.Add(Client.dns);
AThread.Data := Client;
Clients.Add(Client);
statusbar1.Panels[2].Text:=TimeToStr(Time)+' 来自设备'+AThread.Connection.Socket.Binding.PeerIP+' 的呼叫'; // AThread.Connection.Socket.Binding.PeerIP
end;



procedure TFrm_Main.TcpServerExecute(AThread: TIdPeerThread);
var
Client : TSimpleClient;
Com, // System command
Msg : String;
ControlFormat : TControlFormat;
Count: Integer;
begin
// 启动全部设备
try
ControlFormat.iCtrlIdent :=1 ;
ControlFormat.iMessageLen :=1 ;
ControlFormat.iMaxConnect :=1;
ControlFormat.iAnaly :=1;
ControlFormat.iUpload :=1;
ControlFormat.iUploadIntval :=1;
ControlFormat.iTimeUpload :=1;
ControlFormat.iCapture :=1;
ControlFormat.iCountPerFile :=1;
{ Get the text sent from the client }
Msg:= AThread.Connection.Socket.Binding.PeerIP;
{ Get the clients package info }
Client := Pointer(AThread.Data);
{ Check to see if the clients name has been assigned yet }
if Client.Name = 'Logging In' then
begin
{ if not, assign the name and announce the client }
Client.Name := Msg;
AThread.Connection.WriteBuffer(ControlFormat,sizeof(ControlFormat),true);
UpdateClientList;
end
except
AThread.Connection.Disconnect;
AThread.Terminate;
exit;
end;
end;


程序错在什么地方,请各位指教!!!
...全文
61 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cx_super 2003-11-16
  • 打赏
  • 举报
回复
不太可能,因为一旦客户端断开连接,AThread就要释放,
laodiao 2003-11-13
  • 打赏
  • 举报
回复
没有办法啊,大家都没有回答。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
laodiao 2003-11-11
  • 打赏
  • 举报
回复
怎么没有人响应阿?

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧