A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/093602.html below:

ftplib -- how to timeout a connection

ftplib -- how to timeout a connectionJames Sleeman bitsy_boffin at cyberdude.com
Sat Apr 28 15:08:11 EDT 2001
Hi all,
	I have written a small multi threaded application using a
pygtk/python-gnome/glade interface which polls a list of FTP sites tring
to either get a recursive directory listing, or download a file.  Each
site is only hit once in every x seconds.  I wrote it to leech files from
very busy sites with small maximum users and hmmering protection.

Anyway...for the averge FTP site this works great, i rack up 8 threads
polling sites and the main thread handling the GUI (for adding/editing
sites, queueing files, and displaying status).  However it
seems I have a few problem sites in there... when the thread tries to
connect to the site it sits for maybe 2 minutes before it gives up trying
to connect.  I want some way of specifying a connect timeout such that if
the connection phase (including login) has not completed in n seconds
that it should fail (throw an exception) then and there.

Can anybody think of a way I can do this ?


Really I'd like something like this....
	
try :
	self.ftpConnection = FTP()
	self.ftpConnection.connect(self.Host, self.Port)
	self.ftpConnection.login(self.User, self.Pass)
except connectTimeout :
	blah blah blah....


Ideas anyone ?

---
James Sleeman

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4