socket settimeout ?

Discussion in 'Python' started by Colin Brown, Dec 3, 2003.

  1. Colin Brown

    Colin Brown Guest

    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
     
    Colin Brown, Dec 3, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    757
    Lawrence D'Oliveiro
    Apr 7, 2006
  2. Laszlo Nagy
    Replies:
    1
    Views:
    4,858
    Mark Wooding
    Jan 27, 2009
  3. Jean-Paul Calderone
    Replies:
    0
    Views:
    974
    Jean-Paul Calderone
    Jan 27, 2009
  4. Laszlo Nagy
    Replies:
    0
    Views:
    553
    Laszlo Nagy
    Feb 1, 2009
  5. Steve Holden
    Replies:
    0
    Views:
    669
    Steve Holden
    Feb 1, 2009
Loading...

Share This Page