开发者

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

开发者 https://www.devze.com 2023-04-01 10:28 出处:网络
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.

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 us开发者_如何学Ce 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).

See also http://uk.php.net/connection_handling


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号