asyncore/asynchat do not notify connection errors on Wintel?

Z. Kotzer

Usenet Archive
Joined
Mar 15, 2006
Messages
1
Reaction score
0
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

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top