SSLContext.wrap_socket(sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None)
Wrap an existing Python socket sock and return an SSLSocket
object. sock must be a SOCK_STREAM
socket; other socket types are unsupported.
The returned SSL socket is tied to the context, its settings and certificates. The parameters server_side, do_handshake_on_connect and suppress_ragged_eofs have the same meaning as in the top-level wrap_socket()
function.
On client connections, the optional parameter server_hostname specifies the hostname of the service which we are connecting to. This allows a single server to host multiple SSL-based services with distinct certificates, quite similarly to HTTP virtual hosts. Specifying server_hostname will raise a ValueError
if server_side is true.
Changed in version 3.5: Always allow a server_hostname to be passed, even if OpenSSL does not have SNI.
Please login to continue.