473,382 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Re: POP connection timeout.

En Thu, 08 May 2008 09:24:37 -0300, Aspersieman <as*********@gmail.comescribió:
I have written an application that queries a POP mailbox and
downloads messages. When the application tries to connect to the mail
server, but takes too long (eg. longer than 60 seconds) I want to have
it time out.

Something like

try:
pop = poplib.POP3(POPHOST, POPPORT)
except someerror, err:
print "Connecting to mail box has timed out:\n", err

I know that in python 2.5 I could pass an additional timeout parameter
to the above statement ( ie: pop = poplib.POP3(POPHOST, POPPORT,
TIMEOUTINSECONDS), but I am using python 2.4.
Use socket.setdefaulttimeout(timeout_in_seconds) before you create the POP3 object; this value will be used by the initial connect. Once it is connected, you can set a different timeout for retrieving mail using pop.sock.settimeout(...)
Note that setdefaulttimeout applies to ALL subsequent socket operations, not only using poplib.
<http://docs.python.org/lib/socket-objects.html>

--
Gabriel Genellina

Jun 27 '08 #1
0 1111

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

Similar topics

2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
3
by: kant | last post by:
stringA= "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;PWD=password;Initial Catalog=DB;Data Source=127.0.0.1;Connect Timeout=30" stringB = "Provider=Microsoft.Jet.OLEDB.4.0; Data...
6
by: Nifty | last post by:
After creating a routine to select from past ADODB connection strings, I found that it takes 60 seconds to timeout! I found the Microsoft article below ...
7
by: C# beginner | last post by:
I'm struggling with a timeout problem today. ConnectionString = "Integrated Security=true;Database=MyDatabase;Data Source=(local); Connection Timeout = 180;"; My connection string is set as...
7
by: ZRexRider | last post by:
Hi, I'm developing an application that runs on laptops that periodically connect to network. I am collecting data in local tables within the MDB. I want to recognize the occasional network...
0
by: Christopher H. Laco | last post by:
I'm in a strange situation. I have a dataset that uses it own connection string from MySettings. All is well. This thing works in .NET just dandy. If I reference this dataset from another...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
6
by: michael sorens | last post by:
I have used the visual designer to create a series of DataGridViews populated from SQLServer data. A typical call is: myCountsTableAdapter.Fill(myDataSet.myCounts); My application actually...
4
by: Fred Zuckerman | last post by:
I have a A2K database that includes some linked tables (these links are SQL views). Sometimes there are "issues" with the SQL server and the users receive a timeout error whenever they try to...
7
by: =?Utf-8?B?Sm9obiBTdGFnZ3M=?= | last post by:
Hello, Please read this all before giving an answer :) I'm doing some troubleshooting on a web application that my company wrote. It's written in asp.net 1.1. The error that the Event viewer...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.