asyncore/asynchat do not notify connection errors on Wintel?

Discussion in 'Python' started by Z. Kotzer, Mar 15, 2006.

  1. Z. Kotzer

    Z. Kotzer Guest

    I can not get error notifications when an asynchat based client tries to
    connect to a non-responsive address.

    To validate the problem I changed lib/test/test_asynchat.py as follows:


    class echo_client(asynchat.async_chat):
    def __init__(self):
    asynchat.async_chat.__init__(self)
    self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
    self.connect(('10.135.0.2', PORT)) # <<<<<<<< Instead of HOST - set
    an address that does not listen to this port
    self.set_terminator("\n")
    self.buffer = ""

    # <<<<<<<<<<<<<<< And added an error handler
    def handle_error(self):
    print 'ERROR'


    Running it prints nothing - handle_error is not called and nothing is raised
    from asyncore.loop().

    Debugging it shows that asyncore.connect gets EWOULDBLOCK and returns
    normally (as may be expected), select in asyncore.poll returns nothing
    (including empty e) and the socket remains forever.

    Anybody has an experience with this behaviour?

    Thanks in advance!
     
    Z. Kotzer, Mar 15, 2006
    #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. Michael Welsh

    asyncore asynchat

    Michael Welsh, Jul 15, 2003, in forum: Python
    Replies:
    0
    Views:
    538
    Michael Welsh
    Jul 15, 2003
  2. F.G.Testa

    asyncore/asynchat

    F.G.Testa, Nov 14, 2003, in forum: Python
    Replies:
    4
    Views:
    440
    MetalOne
    Nov 17, 2003
  3. Joshua Moore-Oliva

    asyncore, asynchat and threads

    Joshua Moore-Oliva, Aug 4, 2004, in forum: Python
    Replies:
    4
    Views:
    1,093
    Joshua Moore-Oliva
    Aug 4, 2004
  4. Josh Close

    asynchat connection timeout

    Josh Close, Aug 26, 2004, in forum: Python
    Replies:
    1
    Views:
    351
    Brian Gough
    Aug 27, 2004
  5. David Hirschfield

    Help: asyncore/asynchat and terminator string

    David Hirschfield, Jan 16, 2007, in forum: Python
    Replies:
    0
    Views:
    342
    David Hirschfield
    Jan 16, 2007
Loading...

Share This Page