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! 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to