asyncore/asynchat do not notify connection errors on Wintel?

Z

Z. Kotzer

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!
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top