> Should I use a AntiFreeze component on every form I have a TIdTCPClient 
> component?  Or is one enough to handle the whole Application?

One is enough. According to the Indy help file,

-------- 
Only one TIdAntiFreeze can be active in an application. If another 
instance already exists, an exception is raised. 
--------

Note that if you have multiple TIdTCPClient objects connected at the 
same time, and you call ReadXXX twice or more often (e. g. on a button 
click event) in the main thread context, then the last called ReadXXX 
will return first, blocking the other ReadXXX requests even if they 
could return data. This is because of the nature of the AntiFreeze 
mechanism.

To avoid this effect, use a dedicated reader thread for each connection 
instead of AntiFreeze. There is a TIdTCPClient descendant with its own 
reader thread, firing an event when data arrive, at 
http://come.to/delphi-bits .

-Michael

TIdAntiFreeze
Prevents an application UI from freezing.
TIdAntiFreeze = class(TIdAntiFreezeBase)
Unit
Description
Indy works on the blocking model. That is when calls are made to Indy the do not return until they are complete. If calls are made in the main thread this will cause the Application User Interface to "freeze" during Indy calls. TIdAntiFreeze counter acts this effect. TIdAntiFreeze allows Indy subsystem to make process Application message calls so that Windows messages continue to be executed while Indy blocking socket calls are in effect.

Only one TIdAntiFreeze can be active in an application. If another instance already exists, an exception is raised. TIdAntiFreezeBase uses the global variable GAntiFreeze, declared in the TIdAntiFreezeBase unit, to determine if another instance has already been created.

Note: GAntiFreeze is not assigned if an instance is added in the form designer (during design time).

Note: The TIdAntiFreeze.pas unit must NOT appear in the uses clause of any Indy or descendant unit. This unit is linked in an application when the component is placed on a Form. This is done to preserve isolation from the Forms.pas and QForms.pas units.


TIdAntiFreeze.Process
Implements TIdAntifreeze functionality.
procedure Process; override;
Description
Process is the overridden implementation of the abstract virtual TIdAntiFreezeBase.Process method. Process inspects the ApplicationHasPriority property to determine if Application.ProcessMessages is called. If False, the pending Windows message is dispatched to Application.HandleMessage.

Note: Due to the differences in message dispatching, Process does not use or inspect ApplicationHasPriority on the Linux Platform; Process simply calls Application.ProcessMessages.

Note: The TIdAntiFreeze.pas unit must NOT appear in the uses clause of any Indy or descendant unit. This unit is linked in an application when the component is placed on a Form. This is done to preserve isolation from the FORMS.PAS and QForms.pas units.

Indy FTP 警告:Only one TIdAntiFreeze can be active in an application的更多相关文章

  1. ftp 229

    在sels10机器上登入ftp输入用户名和密码之后再ls发现出现如下问题Entering Extended Passive Mode ftp> ls229 Entering Extended P ...

  2. Different between Telnet/SSH/FTP

    http://www.differencebetween.net/category/technology/protocols-formats/ Telnet vs SSH Secure Shell, ...

  3. ftp的主动模式active mode和被动模式 passive mode的配置和区别

    ftp的主动模式active mode和被动模式 passive mode的配置和区别 2017年05月08日 17:47:16 阅读数:21768 本文主要记录的是在linux上的区别,弄了一整天才 ...

  4. iOS警告框和操作表

    应用如何与用户交流呢? 警告框(AlertView)和操作表(ActionSheet)就是为此而设计的. 本文案例的原型草图如图3-48所示,其中有两个按钮“Test警告框”和“Test操作表”,点击 ...

  5. IdTcpClient简单示例

    procedure TForm1.btnHttpGetClick(Sender: TObject); begin idtcpclnt1.Host := '192.168.10.88'; idtcpcl ...

  6. Codeigniter

    最近准备接手改进一个别人用Codeigniter写的项目,虽然之前也有用过CI,但是是完全按着自己的意思写的,没按CI的一些套路.用在公众的项目,最好还是按框架规范来,所以还是总结一下,免得以后别人再 ...

  7. 总结Codeigniter的一些优秀特性

    总结Codeigniter的一些优秀特性 近期准备接手改进一个别人用Codeigniter写的项目.尽管之前也实用过CI,可是是全然按着自己的意思写的,没按CI的一些套路.用在公众的项目,不妨按框架规 ...

  8. Codeigniter的一些优秀实践

    最近准备接手改进一个别人用Codeigniter写的项目,虽然之前也有用过CI,但是是完全按着自己的意思写的,没按CI的一些套路.用在公众的项目,最好还是按框架规范来,所以还是总结一下,免得以后别人再 ...

  9. 转:Delphi 6 实用函数

    来自: daocaoren0824, 时间: -- ::, ID: 再给你一份 程序员实用函数 {▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎▎} {▎ ▎} {▎ 大 ...

随机推荐

  1. 跟我从零基础学习Unity3D开发--NGUI入门基础

    英雄联盟(撸啊撸) QQ飞车 魔兽世界等等相信大家都玩过游戏吧,玩过那UI知道是什么吧?UI可能说得有点专业的话那么游戏中那些属性面板例如: 现在对UI有一定认识了吧!回想一下您玩过的游戏就一定知道什 ...

  2. 1130mysql explain中的type列含义和extra列的含义

    很多朋友在用mysql进行调优的时候都肯定会用到explain来看select语句的执行情况,这里简单介绍结果中两个列的含义. 1 type列 官方的说法,说这列表示的是"访问类型" ...

  3. awk中gsub的应用

    (1)文件filename的内容 cat awk_file 1 2 3 $1,200.00 1 2 3 $2,300.00 1 2 3 $4,000.00 (2)去掉第四列的$和,并汇总第四列的和. ...

  4. BZOJ 2120: 数颜色

    2120: 数颜色 Time Limit: 6 Sec  Memory Limit: 259 MBSubmit: 3623  Solved: 1396[Submit][Status][Discuss] ...

  5. bzoj4726【POI2017】Sabota?

    首先可以推出来如果i没有带头叛变,那么i的父亲也一定不会带头叛变,证明显然 所以最劣情况初始的叛徒肯定是叶子,并且带头叛变的人一定是从某个叶子往上走一条链 f[i]表示i不带头叛变的话最小的x 那么我 ...

  6. css-css权威指南学习笔记5

    第六章 文本属性 1.text-indent只能作用于块级元素(如p或inline-block或block后的span/a/i等). 2.text-align只能作用于块级元素(如p或inline-b ...

  7. TAC Alpha版本 冲冲冲!!!

    第1天 第2天 第3天 第4天 第5天 第6天 第7天 第8天 第9天 第10天 测试随笔 冲刺总结

  8. gRPC+etcd的优势分析

    相比webService等可跨平台,跨语言的服务相比,gRPC更增加了以下优势 1.可以采用二进制传输,速度更快 (使用TCP传输层,而不是Http2应用层) 2.集群服务,统一注册,可靠性高( 好的 ...

  9. 深度分析mysql GROUP BY 与 ORDER BY

    鉴于项目的需要,就从网上找到该文章,文章分析得很详细也很易懂,在android里,(不知道是不是现在水平的限制,总之我还没找到在用ContentProvider时可以使用子查询),主要方法是用SQLi ...

  10. Google Map API V3开发(5)

    Google Map API V3开发(1) Google Map API V3开发(2) Google Map API V3开发(3) Google Map API V3开发(4) Google M ...