socket settimeout ?

C

Colin Brown

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
 

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

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top