delphi中indy10 的Idtcpserver断开客户端连接报错问题的解决办法


本文整理自网络,侵删。

 我们常用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 时间与相关类型(2) - tdate、ttime、ttimestamp

Delphi android adb usb上读取设备信息

Delphi获取开机时间代码

Delphi 老外分享的textfile高速遍历大数据文本

Delphi 最简单的文件大小bytes转mb

Delphi �o置系�y�r�g

Delphi android gps服务

Delphi禁用、启用usb

Delphi-改进获取文件md5 hash方法

Delphi删除文件和文件夹

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...