2004年02月19日 星期四 09:49
我的意思是收到从第10字节开始的60个字节就停止, 为什么我的运行结果是从第10字节开始的所有数据都收下来 了之后服务器才对我发的ABOR有响应呢? 服务器是ser-u4.0不可能不支持断点续传的呀。 我的程序是这样的: from ftplib import FTP def cb( s ): global f, a a = a + len( s ) print 'cb( %s )' % s if a >=60: print 'SendAbor!!' f.abort() a = 0 print '----------------------------' host = '202.120.113.31' port = 22 login = 'leojay' passwd = 'leojayhaha' f = FTP() print "Connecting to '%s%s'..." % (host,port) print 'f.connect(host,port):', f.connect(host,port) print 'Logging in as %s...' % login print 'f.login( login, passwd ): ', f.login( login, passwd ) print 'f.retrbinary: ', f.retrbinary( 'RETR /n.txt', cb, 20, 10 ) print 'f.quit(): ', f.quit() print 'a =', a 服务器上的文件n.txt是这样的: Name: Rich 7 [Game] License:Trade Language:Simplified Chinese Means:First Enclosure:CloneCD Image & Alcohol Image (2CD) Official WebSite:http://www.unistar.net.cn/ Supply:by Sms2000[LJF] 运行的输出是这样的: ---------------------------- Connecting to '202.120.113.3122'... f.connect(host,port): 220 Serv-U FTP Server v4.0 for WinSock ready... Logging in as leojay... f.login( login, passwd ): 230 User logged in, proceed. f.retrbinary: cb( 7 [Game] License:T ) cb( rade Language:Simpl ) cb( ified Chinese Means ) SendAbor!! cb( :First Enclosure:Cl ) SendAbor!! cb( oneCD Image & Alcoho ) SendAbor!! cb( l Image (2CD) Offic ) SendAbor!! cb( ial WebSite:http://w ) SendAbor!! cb( ww.unistar.net.cn/ ) SendAbor!! cb( Supply:by Sms2000[LJ ) SendAbor!! cb( F] ) SendAbor!! 226 ABOR command successful. f.quit(): 221 Goodbye! a = 182 显然是发了好几次ABOR给服务器,但都没结果的嘛 哪位大哥知道是怎么回事吗?谢谢了
Zeuux © 2024
京ICP备05028076号