timeout and sockets example request??

I

Ishwar Rattan

In section 7.2 of Python library reference manual:

exception timeout
This exception is raised when a timeout occurs on a socket which has had
timeouts enabled via a prior call to settimeout(). The accompanying value
is a string whose value is currently always ``timed out''. New in version 2.3.

I assumed that settimeout() is an attribute of newly created socket object,
but is not so!

What is the correct usage os settimeout(), getdefaulttimeout() and
setdefaulttimeout(seconds) [the last two also from the section 7.2]?

A python code fragemnt to show the usages will be appreciated.

-ishwar
 
D

Dave Brueck

Ishwar said:
In section 7.2 of Python library reference manual:

exception timeout
This exception is raised when a timeout occurs on a socket which has had
timeouts enabled via a prior call to settimeout(). The accompanying value
is a string whose value is currently always ``timed out''. New in version 2.3.

I assumed that settimeout() is an attribute of newly created socket object,
but is not so!

What version of Python are you using? Could you post some code showing
what didn't work? Here's why I ask:

Python 2.3.4 (#53, May 25 2004, 21:17:02)...
Type "help", "copyright", "credits" or "l...
(no errors)

setdefaulttimeout is handy when you don't have access to the actual
socket object, e.g.:
'<html><head><meta http-equiv="content-type" content=...

-Dave
 
I

Ishwar Rattan

Dave Brueck said:
Ishwar Rattan wrote:
What version of Python are you using? Could you post some code showing
what didn't work? Here's why I ask:

Python 2.3.4 (#53, May 25 2004, 21:17:02)...
Type "help", "copyright", "credits" or "l...

(no errors)

setdefaulttimeout is handy when you don't have access to the actual
socket object, e.g.:

'<html><head><meta http-equiv="content-type" content=...

-Dave

Thanks for the example. It comes out that I ws running python-2.2.3 :-(

-ishwar
 
D

Dave Brueck

Ishwar said:
Dave Brueck said:
Ishwar Rattan wrote:
What version of Python are you using? Could you post some code showing
what didn't work? Here's why I ask:

Python 2.3.4 (#53, May 25 2004, 21:17:02)...
Type "help", "copyright", "credits" or "l...

(no errors)
[snip]
Thanks for the example. It comes out that I ws running python-2.2.3 :-(

Note that if you can't upgrade to 2.3, timeoutsocket.py is a good
alternative:

http://www.timo-tasi.org/python/timeoutsocket.py

-Dave
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top