socket settimeout ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Colin Brown

    socket settimeout ?

    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 setdefaulttimeo ut 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.nextConnAdd r()
    print conn
    print
    print dir(conn[0])
    conn[0].settimeout(30. 0)
    rcv.rxThread(co nn)
    output:
    (<socket._socke tobject 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




Working...