简体   繁体   中英

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 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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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