ftplib retrlines timeout

BJ Swope bigblueswope at gmail.com
Wed Dec 16 14:23:26 EST 2009


I've had experiences with some python mail servers that time out connections
if data from the socket is not sent to the application within the timeout
parameter.

I have seen a python app on FreeBSD that would timeout a connection after
600 seconds if freebsd did not receive at least 32 kb of data within the 600
second timeout.  FreeBSD would only send from the buffer to the app if there
was 32kb of data, unless TCP segments were received with the PUSH flag set
which would force a flush of the network buffer.

It sounds like this is the behavior Brendan is seeing.


----
Auburn fans are like slinkys... not really good for anything but they still
bring a smile to your face when you push them down a flight of stairs.

To argue that honorable conduct is only required against an honorable enemy
degrades the Americans who must carry out the orders. -- Charles Krulak,
Former Commandant of the Marine Corps

We are all slave to our own paradigm. -- Joshua Williams

If the letters PhD appear after a person's name, that person will remain
outdoors even after it's started raining. -- Jeff Kay



On Wed, Dec 16, 2009 at 7:41 AM, Brendan <brendandetracey at yahoo.com> wrote:

> On Dec 15, 6:17 pm, Jennifer <owenzhang.chic... at gmail.com> wrote:
> > I am writing a program that has a requirement for  a timeout of
> > retrlines after the connection established. I just wonder if timeout
> > of ftplib.FTP('xxxx.xxx.com',username,password,timeout) will work for
> > retrlines method after the connection established. Or
> > socket.setdefaulttimeout will work in this case. Please let me know.
> >
> > What exception will be throwed if ftp.retrlines timed out.
> >
> > Many Thanks!
> >
> > - Jennifer
>
> I asked a similar question on here a few days ago and got no response,
> however I tried a large download which timed out with the following:
> Traceback (most recent call last):
>  File "./download_r1_neodf.py", line 167, in <module>
>    result = ftp.quit()
>  File "/usr/local/lib/python2.6/ftplib.py", line 566, in quit
>    resp = self.voidcmd('QUIT')
>  File "/usr/local/lib/python2.6/ftplib.py", line 248, in voidcmd
>    return self.voidresp()
>  File "/usr/local/lib/python2.6/ftplib.py", line 223, in voidresp
>    resp = self.getresp()
>  File "/usr/local/lib/python2.6/ftplib.py", line 209, in getresp
>    resp = self.getmultiline()
>  File "/usr/local/lib/python2.6/ftplib.py", line 195, in getmultiline
>    line = self.getline()
>  File "/usr/local/lib/python2.6/ftplib.py", line 182, in getline
>    line = self.file.readline()
>  File "/usr/local/lib/python2.6/socket.py", line 406, in readline
>    data = self._sock.recv(self._rbufsize)
> socket.error: [Errno 110] Connection timed out
>
>
> BTW, if you want to use the timeout paramter, you must also use the
> account parameter. Set it to ''.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091216/39f1bbbf/attachment.html>


More information about the Python-list mailing list