[Python-Dev] ssl module, non-blocking sockets and asyncore integration (original) (raw)

Giampaolo Rodola' gnewsg at gmail.com
Sun Sep 14 22:16:26 CEST 2008


Hi, I try to revamp a discussion I raised some time ago and which seems to be not solved yet. I'm interested in using the ssl module with asyncore but since there's no real documentation about how using ssl module with non-blocking sockets I've not been able to write something useful with it. I took a look at Test/test_ssl.py which seems to include a test consisting in an asyncore-based secure server but I noticed something strange:

            def __init__(self, conn, certfile):
                asyncore.dispatcher_with_send.__init__(self, conn)
                self.socket = ssl.wrap_socket(conn,

server_side=True, certfile=certfile,

do_handshake_on_connect=True)

I'm not sure about the real meaning of the do_handshake_on_connect parameter but if it does what I think it should block the application as long as the handshake isn't finished, which is not acceptable in an asynchronous environment. Am I misunderstanding something? Does the ssl module can actually be used with non-blocking sockets? If so which is the proper/recommended way to do that?

Thanks in advance

--- Giampaolo http://code.google.com/p/pyftpdlib/



More information about the Python-Dev mailing list