在XE8中,使用indy10里有关TCP连接的控件时,断开连接有时候会抛出Connection Closed Gracefully的异常,下面我找到了抛出该异常的源码:

procedure TIdIOHandler.RaiseConnClosedGracefully;
begin(* ************************************************************* //------ If you receive an exception here, please read. ----------If this is a SERVER-------------------The client has disconnected the socket normally and this exception is used to notify theserver handling code. This exception is normal and will only happen from within the IDE, notwhile your program is running as an EXE. If you do not want to see this, add this exceptionor EIdSilentException to the IDE options as exceptions not to break on.From the IDE just hit F9 again and Indy will catch and handle the exception.Please see the FAQ and help file for possible further information.The FAQ is at http://www.nevrona.com/Indy/FAQ.htmlIf this is a CLIENT-------------------The server side of this connection has disconnected normaly but your client has attemptedto read or write to the connection. You should trap this error using a try..except.Please see the help file for possible further information.// ************************************************************* *)raise EIdConnClosedGracefully.Create(RSConnectionClosedGracefully);
end;

中文翻译:

(* ************************************************************* //
  ------ If you receive an exception here, please read. ----------

------ 如果你收到此异常,请阅读下面内容 ----------

If this is a SERVER

如果是服务器
  -------------------
  The client has disconnected the socket normally and this exception is used to notify the
  server handling code. This exception is normal and will only happen from within the IDE, not
  while your program is running as an EXE. If you do not want to see this, add this exception
  or EIdSilentException to the IDE options as exceptions not to break on.

客户端已经正常关闭该套接字了,这个异常用来提示服务器处理该代码。

这个异常很正常,并且只会在IDE中发生,在可执行文件(EXE)中并不会发生。

如果你不想看到它,可以在IDE选项中设置EIdSilentException这个异常不被打断。

From the IDE just hit F9 again and Indy will catch and handle the exception.

在IDE中,只要再次按下F9,indy将会捕捉并处理该异常。

Please see the FAQ and help file for possible further information.
  The FAQ is at http://www.nevrona.com/Indy/FAQ.html
请查看有关的FAQ和帮助文档。

FAQ是http://www.nevrona.com/Indy/FAQ.html

If this is a CLIENT

如果是客户端
  -------------------
  The server side of this connection has disconnected normaly but your client has attempted
  to read or write to the connection. You should trap this error using a try..except.
  Please see the help file for possible further information.
服务端已经正常关闭连接了,可是客户端却尝试从该连接中读写数据。

你应该用try...except捕捉此错误。

请看有关的帮助文档。

// ************************************************************* *)

XE8-indy10中关于Connection Closed Gracefully的源码与解读相关推荐

  1. 关于Indy TIdTCPServer控件出现 connection closed gracefully 错误的处理

    简单的说,当TidTCPServer调用Read方法接收数据时.或调用Write方法发送数据时,客户端主动直接断开了连接,就会触发该异常:这是正常,忽略这一错误就可以了. Indy : Connect ...

  2. 关于Connection Closed Gracefully问题

    Connection Closed Gracefully 温和的关闭连接 Many Indy users are annoyed by the EIdConnClosedGracefully exce ...

  3. 在用Delphi 10.2.3 提示connection closed gracefully的处理

    在用Delphi 10.2.3制作一个Android app的时候用了idhttp控件,post数据能成功,但每次都会提示connection closed gracefully 错误信息,网上找了一 ...

  4. [delphi]ssl connection closed gracefully

    之前写了一个基于ssl的API接口程序,原先用得好好的,也有段时间没有用过了,在解析的时候,出现了一个Connection Closed Gracefully的错误提示,并且程序中断了后面的代码执行, ...

  5. Idhttp get baidu 错误 connection closed Gracefully

    url:=IdHTTP1.get('http://www.baidu.com'); memo1.text:=url; 就这么简短的一个代码,他既然报个connection closed Gracefu ...

  6. Spring中AOP相关的API及源码解析,原来AOP是这样子的

    前言 之所以写这么一篇文章主要是因为下篇文章将结束Spring启动整个流程的分析,从解析配置到创建对象再到属性注入最后再将创建好的对象初始化成为一个真正意义上的Bean.因为下篇文章会涉及到AOP,所 ...

  7. Java生鲜电商平台-SpringCloud微服务架构中网络请求性能优化与源码解析

    Java生鲜电商平台-SpringCloud微服务架构中网络请求性能优化与源码解析 说明:Java生鲜电商平台中,由于服务进行了拆分,很多的业务服务导致了请求的网络延迟与性能消耗,对应的这些问题,我们 ...

  8. java arraylist 常用方法_分享ArrayList中的几个常用方法的源码

    jdk1.7.0_79 上文里解析了有关ArrayList中的几个常用方法的源码--<有关ArrayList常用方法的源码解析>,本文将对LinkedList的常用方法做简要解析. Lin ...

  9. Android研发中对String的思考(源码分析)

    1.常用创建方式思考: String text = "this is a test text "; 上面这一句话实际上是执行了三件事  1.声明变量 String text; 2. ...

最新文章

  1. leetcode Edit Distance
  2. log4j:WARN No such property [datePattern] in org.apache.log4j.RollingFileAppender.
  3. Linux下各文件夹的结构说明及用途介绍(转载)
  4. Singleton模式笔记
  5. VScode 1.4新版功能
  6. [渝粤教育] 天津现代职业技术学院 餐饮服务实务(翁莉) 参考 资料
  7. linux上git克隆命令,Git clone命令用法
  8. 如何开发小程序开发者工具?
  9. 郑州轻工业学校计算机网络,计算机网络期末考试a卷(郑州轻工业学院).doc
  10. u盘读写测试_aigo U395固态U盘评测,速度可能会吓到你,价格很良心
  11. [转载] 树莓派并行控制电机_使用由并行端口控制的软盘驱动步进电机的相机摇摄器
  12. 今日头条向百度“开炮”:瞄准百度铁饭碗,上万台机器已在运作
  13. vue2.0项目部署到服务器_阿里云服务器搭建及项目部署过程---小白篇
  14. xp系统能不能安装mysql_win xp32位系统安装mysql详细步骤
  15. 小福利,e分钟带你爬取海量专利数据并保存为excel文件
  16. warning: control reaches end of non-void function(C语言编译报错)
  17. 苹果开发者怎么避免封号
  18. TDS:标签平台+API平台+数据共享平台,助力数据运营平台建设
  19. 【单片机】msp430几种不同开发平台的对比
  20. stol函数在linux下使用,C++中进制转换问题

热门文章

  1. 从尾到头打印一个链表
  2. 顺序表中将奇数排在偶数前面。
  3. 配置OpenStack准备环境
  4. 在anaconda中创建虚拟环境
  5. 计算机文化基础008,山东省计算机文化基础选择题
  6. kotlin中标准函数的使用(with、also、aply、let、run)
  7. 校园超市购物小程序 计算机毕业设计
  8. 如何做一个出色的固定资产管理员?
  9. 2022年湖北省大数据产业发展规划
  10. 爬虫-自动化完成上百题目