FTP without timeout?

Discussion in 'Python' started by Chris, Oct 4, 2004.

  1. Chris

    Chris Guest

    How do I setup an FTP connection without timeout using ftplib.FTP?

    I've tried
    ftp = ftplib.FTP('server')
    ftp.login('user', 'xxx')
    ftp.sock.settimeout(None)
    or
    ftp.sock.settimeout(3600)
    or
    ftp.sock.setblocking(True)
    but it always timeout after 10 minutes of inactivity.
    The server allows idle up to 240 minutes before disconnecting.

    Please help! Thanks in advance.

    Chris
     
    Chris, Oct 4, 2004
    #1
    1. Advertising

  2. Chris

    Steve Holden Guest

    Chris wrote:

    > How do I setup an FTP connection without timeout using ftplib.FTP?
    >
    > I've tried
    > ftp = ftplib.FTP('server')
    > ftp.login('user', 'xxx')
    > ftp.sock.settimeout(None)
    > or
    > ftp.sock.settimeout(3600)
    > or
    > ftp.sock.setblocking(True)
    > but it always timeout after 10 minutes of inactivity.
    > The server allows idle up to 240 minutes before disconnecting.
    >
    > Please help! Thanks in advance.
    >
    > Chris
    >
    >

    Try putting

    import socket
    socket.setdefaulttimeout(240*60)

    at the start of your code to see whether this makes a difference. This
    ensures that the socket timeout is established before a connection is
    made to the remote endpoint.

    Though frankly, from the documentation, since there doesn't appear to be
    a default timeont on sockets, I'm not sure where this bizarre ten minute
    timeout is coming from. The string "time" doesn't appear at all in the
    ftplib source, so I'm somewhat stumped.

    Are you sure the server doesn't require some sort of keepalive from the
    client?

    regards
    Steve
    --
    http://www.holdenweb.com
    http://pydish.holdenweb.com
    Holden Web LLC +1 800 494 3119
     
    Steve Holden, Oct 4, 2004
    #2
    1. Advertising

  3. Chris

    Dave Brueck Guest

    Steve Holden wrote:
    > Chris wrote:
    >
    >> How do I setup an FTP connection without timeout using ftplib.FTP?

    [snip]
    > Though frankly, from the documentation, since there doesn't appear to be
    > a default timeont on sockets, I'm not sure where this bizarre ten minute
    > timeout is coming from. The string "time" doesn't appear at all in the
    > ftplib source, so I'm somewhat stumped.
    >
    > Are you sure the server doesn't require some sort of keepalive from the
    > client?


    An intermediate firewall could also need a keepalive - it's not uncommon for
    them to kill idle connections after a few minutes.

    -Dave
     
    Dave Brueck, Oct 4, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. someone

    FTP over SSL vs FTP over SSH

    someone, Apr 24, 2004, in forum: Java
    Replies:
    1
    Views:
    4,650
    iksrazal
    Apr 25, 2004
  2. Replies:
    3
    Views:
    5,775
  3. Nico Grubert
    Replies:
    0
    Views:
    684
    Nico Grubert
    Nov 24, 2005
  4. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,351
    Brian Candler
    Oct 6, 2004
  5. D. Buck
    Replies:
    2
    Views:
    594
    D. Buck
    Jun 29, 2004
Loading...

Share This Page