473,507 Members | 9,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FTP HANGS on very slow connection

Hi,
I am trying to download data from remote ftp server connected through
GSM modem. The speed is slow 1kB/s. Despite the classic linux ftp
client works fine the ftp.retrbinary(),ftpretrlines() function from
ftplib hangs. I am able succesfuly login but a can not download. It has
probably something common with sockets.

Code:
***************************************
#Open ftp connection and downloads file
ftpDLoad = FTP(hostAdress)
ftpDLoad.set_debuglevel(2)
#ftpDLoad.sendcmd('USER xxxxx')
#ftpDLoad.sendcmd('PASS xxxxx')
ftpDLoad.login(userName,userPass)
#print ftpDLoad.login()

#Prints start time
print '###Starting sync.: ',datetime.today()

#Opens file for writing
fileObj = open(tmpDir + rFileName,'wb')

#Downloads file
#!!!!!!!!!!!
#ftpDLoad.retrbinary('RETR ' + rFileName, fileObj.write)
#!!!!!!!!!!!
ftpDLoad.retrlines('RETR' + rFileName)

#Closes file
fileObj.close()

#Checks the file size
ftpDLoad.cwd('modem')
Ouput:
******************************************
michal@telis:~/python$ ./jezeri_new_ftp.py
*cmd* 'USER telis'
*put* 'USER telis\r\n'
*get* '331 Password required for telis\r\n'
*resp* '331 Password required for telis'
*cmd* 'PASS ******'
*put* 'PASS ******\r\n'
*get* '230 Logged on\r\n'
*resp* '230 Logged on'
###Starting sync.: 2006-08-10 22:17:06.634695
*cmd* 'TYPE A'
*put* 'TYPE A\r\n'
*get* '200 Type set to A\r\n'
*resp* '200 Type set to A'
*cmd* 'PASV'
*put* 'PASV\r\n'
Traceback (most recent call last):
File "./jezeri_new_ftp.py", line 43, in ?
ftpDLoad.retrlines('RETR' + rFileName)
File "/usr/lib/python2.4/ftplib.py", line 396, in retrlines
conn = self.transfercmd(cmd)
File "/usr/lib/python2.4/ftplib.py", line 345, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
File "/usr/lib/python2.4/ftplib.py", line 321, in ntransfercmd
host, port = self.makepasv()
File "/usr/lib/python2.4/ftplib.py", line 299, in makepasv
host, port = parse227(self.sendcmd('PASV'))
File "/usr/lib/python2.4/ftplib.py", line 241, in sendcmd
return self.getresp()
File "/usr/lib/python2.4/ftplib.py", line 207, in getresp
resp = self.getmultiline()
File "/usr/lib/python2.4/ftplib.py", line 193, in getmultiline
line = self.getline()
File "/usr/lib/python2.4/ftplib.py", line 180, in getline
line = self.file.readline()
File "/usr/lib/python2.4/socket.py", line 332, in readline
data = self._sock.recv(self._rbufsize)
socket.error: (104, 'Connection reset by peer')

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Aug 10 '06 #1
0 1961

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1883
by: Eddie | last post by:
I am having a strange issue with MySQL. I just installed it on my Zaurus and loaded a few of my databases in it. All very small. When I do a count withoout a where, it hangs. It does this on all...
11
17525
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
6
8559
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
2
4555
by: JD | last post by:
Hello, I'm experiencing a problem that I'm hoping someone might be able to shed some light on. I have an ASP.NET page on a Windows 2000 machine that makes web service calls to a .NET web...
1
2062
by: rwmh | last post by:
I'm running this on a 2.8 GHz machine with 1.5 GB RAM. (XP machine) The full suite of VS.NET is installed. I'm running 7.1.3088 Professional Edition. Initial launch from within IDE took only...
5
4169
by: PH | last post by:
Hi guys; I got a single processor computer, running an application that launches 2 threads. Each of these threads listens for incoming connections in a specific port, so there is a Loop ....
0
1323
by: jeff.dyke | last post by:
I am using ftplib in some code that does exactly what you would expect. It ftp's files. Its running inside a service running on windows xp and windows 2003 servers, approximately 20 installations...
0
1634
by: Arno Stienen | last post by:
Perhaps I should be a bit more specific. When using this code to connect to a remote XML-RPC server (C++, xmlrpc++0.7 library): import xmlrpclib server =...
3
8980
by: nonstopkaran | last post by:
hey i am handling a small application, it is running well. but very rarely it hangs... (i.e) loggin page itself will take more than 10m and the response will be very very slow. config: ...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.