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. 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.
精彩评论