Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > socket settimeout ?

Reply
Thread Tools

socket settimeout ?

 
 
Colin Brown
Guest
Posts: n/a
 
      12-03-2003
I have set up a socket listener that needs to listen indefinitely. On an
incoming call I get a connection object that I want to set a timeout on
[Win2k, Py2.3.2]. As the setdefaulttimeout method did not work with the new
connection I found (using dir on the socket._socket object) a settimeout
method. Is this (undocumented) method peculiar to Windows or fully
cross-platform?

code fragment:
conn = rcv.nextConnAddr()
print conn
print
print dir(conn[0])
conn[0].settimeout(30.0)
rcv.rxThread(conn)
output:
(<socket._socketobject object at 0x0095B7E0>, ('10.10.192.240', 3524))

['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__slots__', '__str__', '_sock', 'accept',
'bind', 'close', 'connect', 'connect_ex', 'dup', 'fileno', 'getpeername',
'getsockname', 'getsockopt', 'gettimeout', 'listen', 'makefile', 'recv',
'recvfrom', 'send', 'sendall', 'sendto', 'setblocking', 'setsockopt',
'settimeout', 'shutdown']

Thanks
Colin Brown
PyNZ




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Steve Holden Python 0 02-01-2009 12:45 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 0 02-01-2009 07:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM
socket.socket.settimeout implementation jnair@ensim.com Python 1 04-07-2006 09:00 PM



Advertisments