我可以从 Delphi 的 Indy 客户端发送 TCP RST 吗?
我们一直在尝试使用 Delphi Indy(SVN trunk)客户端和带有 mod_php 的 Apache。调用 PHP 脚本来注册关闭函数。
在测试过程中,仅当脚本结束且 connection_status()
返回零时才会调用此关闭函数。
如果我使用 CURL 并在脚本执行期间按 Ctrl-C,CURL 会发送一个 RST 标志设置为布尔值 true 的 TCP 数据包。这确实会触发关闭函数,并且 connection_status()
返回一个。如果连接超时,则会打开 TCP FIN 标志,但不会触发关闭功能 - 事实上,Apache 进程会进入 CLOSE_WAIT 状态,直到 PHP 脚本执行完毕。如果我使用 Indy,唯一设置的标志是 FIN。
考虑到这一切,我们能否让 Indy 发送一个 RST 标志设置为 true 的 TCP 数据包?我们希望在连接超时时执行此操作(解决我们正在测试的问题)。
We have been experimenting with a Delphi Indy (SVN trunk) client and Apache with mod_php. A PHP script is called which registers a shutdown function.
During testing this shutdown function is called only once the script has ended and connection_status()
comes back zero.
If I use CURL and hit Ctrl-C during the script's execution, CURL sends a TCP packet with the RST flag set to boolean true. This does trigger the shutdown function and connection_status()
comes back one. If the connection times out, a TCP FIN flag is switched on but the shutdown function does not trigger - in fact the Apache process goes into CLOSE_WAIT until the PHP script has finished executing. If I use Indy, the only flag that gets set is FIN.
With all this in mind can we get Indy to send a TCP packet with an RST flag set to true? We want to do this when the connection times out (solving the problem we are testing for).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Indy 总是尝试优雅地关闭连接,这不会发送 RST 标志。如果您需要这样做,您将必须自己强行关闭连接。
Indy always tries to close a connection gracefully, which will not send a RST flag. If you need that, you will have to forcibly close the connection yourself.