forcefully close connection + indy10

Giganews Newsgroups
Subject: forcefully close connection + indy10
Posted by:  Pierre Axelsson (nospam@nospam.com)
Date: Thu, 15 Sep 2005

I have a thread that reuses a TIdFTP object through multiple FTP sessions.
At the end of a sessions it should close the connection and by force if
necessary. It's the "by force" stuff I can't get to work in Indy10.

Under Indy9 this worked wonderfully using:
if AFtpClient.Connected then AFtpClient.DisconnectSocket;

According to the docs the equivalent way in indy10 is to do:
if AFtpClient.Connected then AFtpClient.Disconnect(false);

(I've also tried AFtpClient.IOHandler.Close with no success.)

...but it doesn't work. Next time around when I try to connect I get an
exception saying "already connected".

Ideas?

Thanks.
/Pierre

Replies