Apache FTP Client - abort transfer

I am using Apache FTP client to do the FTP transfer. The trasnfer runs in a thread.

I am running another thread for timeout. Once timeout occures i need to terminate transfer if not finished.

For some reason FTPClient.abort doesn't work.

I found some discussion on that issue and tried to override the abort method - it didn't help.

http://apache-commons.680414.n4.nabble.com/Net-FTPClient-abort-problem-td739542.html

 

I tried to "stop" thread - that didn't work either.

 

Any suggestions ?

Thank you in advance.

Comments

kill socket programatically via JNI?

 

 

 

Close local file input (output) stream. This will cause transfer failure.

Thanks everyone for discussion. Solution turned out to be a combination of things.

1. Override FTPClient.abort() as mentioned here

http://apache-commons.680414.n4.nabble.com/Net-FTPClient-abort-problem-td739542.html

2. DO NOT disconnect at the same piece of code, that does the Abort. Instead rely on Disconnect at finally statement.

3. Before Abort, close the input stream. Closing the input by itself, did not help, maybe because my input was another FTP source.