本文整理自网络,侵删。
我们常用IdTCPServer1.Active := false;来关闭Idtcpserver,但这样会出卡机,并且操作也不会成功,后来,我改为这样:
var i: integer; AList: TList;begin AList := IdTCPServer1.Contexts.LockList; try for i := AList.Count - 1 downto 0 do begin TIdContext(AList.Items[i]).Connection.Disconnect; end; finally IdTCPServer1.Contexts.UnlockList; end;
也就是说不要用IdTCPServer1.Active := false;这种方式来断开Idtcpserver。
相关阅读 >>
Delphi 窗体的位置和高宽度-tform:letf、top、width、height、clientwidth、clientheight
Delphixe4 版本中,已针对移动平台 引入了 arc 模型
Delphi 用updateresource修改exe文件图标(已修正)
Delphi 10.3.x与android 10兼容性的问题
更多相关阅读请进入《Delphi》频道 >>