Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to abort a ftp operation

Reply
Thread Tools

How to abort a ftp operation

 
 
Lothar Scholz
Guest
Posts: n/a
 
      07-06-2004
Hello,

i use the ftplib to do some tasks and my GUI offers an "Abort" button
to stop but unfortunately there is no general way to stop the ftp
asynchronously from another thread. Is it possible to simply close the
socket handle from another thread, which should result in some kind of
protocol error on the ftp client.

Please don't tell me i must let my customers wait. Connect timeouts
can be very long.
 
Reply With Quote
 
 
 
 
Ville Vainio
Guest
Posts: n/a
 
      07-06-2004
>>>>> "Lothar" == Lothar Scholz <(E-Mail Removed)> writes:


Lothar> asynchronously from another thread. Is it possible to
Lothar> simply close the socket handle from another thread, which
Lothar> should result in some kind of protocol error on the ftp
Lothar> client.

ftplib.py has the following method in FTP class:

def abort(self):
'''Abort a file transfer. Uses out-of-band data.
This does not follow the procedure from the RFC to send Telnet
IP and Synch; that doesn't seem to work with the servers I've
tried. Instead, just send the ABOR command as OOB data.'''
line = 'ABOR' + CRLF
if self.debugging > 1: print '*put urgent*', self.sanitize(line)
self.sock.sendall(line, MSG_OOB)
resp = self.getmultiline()
if resp[:3] not in ('426', '226'):
raise error_proto, resp

Try that, or just do ftpobject.sock.close()..

--
Ville Vainio http://tinyurl.com/2prnb
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Unable to abort a FTP command? _wdx@163.com Python 2 07-26-2007 02:17 AM
How to abort repair operation =?Utf-8?B?TGlicmFyeSBTeXNhZG1pbg==?= Windows 64bit 3 02-26-2007 06:55 PM
Abort an operation Mangler ASP General 11 01-18-2007 02:28 PM
Net::FTP problems getting files from Windows FTP server, but not Linux FTP Server. D. Buck Perl Misc 2 06-29-2004 02:05 PM



Advertisments