简体   繁体   English

我可以从Delphi的Indy客户端发送TCP RST吗?

[英]Can I send a TCP RST from Delphi's Indy client?

We have been experimenting with a Delphi Indy (SVN trunk) client and Apache with mod_php. 我们一直在尝试使用Delphi Indy(SVN干线)客户端和带有mod_php的Apache。 A PHP script is called which registers a shutdown function. 调用一个PHP脚本,该脚本注册一个关闭功能。

During testing this shutdown function is called only once the script has ended and connection_status() comes back zero. 在测试期间,仅在脚本结束并且connection_status()返回零后,才调用此关闭函数。

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. 如果我使用CURL并在脚本执行过程中按Ctrl-C,则CURL发送一个TCP数据包,其RST标志设置为boolean true。 This does trigger the shutdown function and connection_status() comes back one. 这确实触发了关闭功能,并且connection_status()返回一个。 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. 如果连接超时,则会打开TCP FIN标志,但不会触发关闭功能-实际上,Apache进程进入CLOSE_WAIT,直到PHP脚本执行完毕。 If I use Indy, the only flag that gets set is FIN. 如果使用Indy,唯一设置的标志是FIN。

With all this in mind can we get Indy to send a TCP packet with an RST flag set to true? 考虑到所有这些,我们能否使Indy发送RST标志设置为true的TCP数据包? We want to do this when the connection times out (solving the problem we are testing for). 我们希望在连接超时时执行此操作(解决了我们正在测试的问题)。

See also http://uk.php.net/connection_handling 另请参见http://uk.php.net/connection_handling

Indy always tries to close a connection gracefully, which will not send a RST flag. Indy总是尝试优雅地关闭连接,该连接不会发送RST标志。 If you need that, you will have to forcibly close the connection yourself. 如果需要,则必须自己强制关闭连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM