def __init__(self, server_address, requestHandlerClass, serializerClass, keyfile = None, certfile = None, server_side = False, cert_reqs = 0, ssl_version = 2, ca_certs = None, do_handshake_on_connect = True, suppress_ragged_eofs = True, ciphers = None, timeout = 900, activate = True ): if self.address_family == socket.AF_INET or self.address_family == socket.AF_INET6: self.addrinfo = addrInfo(host = server_address[0],port = server_address[1]) if not hasattr(self,'socket_proto'): self.socket_proto = 0 if not hasattr(self,'socket_canonname'): self.socket_canonname = '' if (self.address_family == socket.AF_INET or self.address_family == socket.AF_INET6) and self.addrinfo._checkInfoById(self.address_family, self.socket_type, self.socket_proto, self.socket_canonname): self.server_address = self.addrinfo._getServerAddressById(self.address_family, self.socket_type, self.socket_proto, self.socket_canonname) else: self.server_address = server_address self.client = socket.socket(self.address_family, self.socket_type, self.socket_proto) self.requestHandlerClass = requestHandlerClass self.serializerClass = serializerClass self.keyfile = keyfile self.certfile = certfile self.server_side = server_side = False self.cert_reqs = cert_reqs self.ssl_version = ssl_version self.ca_certs = ca_certs self.do_handshake_on_connect = do_handshake_on_connect self.suppress_ragged_eofs = suppress_ragged_eofs self.ciphers = ciphers self.socket = ssl.SSLSocket(sock = self.client, keyfile = self.keyfile, certfile = self.certfile, server_side = self.server_side, cert_reqs = self.cert_reqs, ssl_version = self.ssl_version, ca_certs = self.ca_certs, do_handshake_on_connect = self.do_handshake_on_connect, suppress_ragged_eofs = self.suppress_ragged_eofs, ciphers = self.ciphers) self.timeout = timeout if activate: self.client_activate()
def __init__(self, server_address, requestHandlerClass, serializerClass, timeout=900, activate=True): if self.address_family == socket.AF_INET or self.address_family == socket.AF_INET6: self.addrinfo = addrInfo(host=server_address[0], port=server_address[1]) if not hasattr(self, "socket_proto"): self.socket_proto = 0 if not hasattr(self, "socket_canonname"): self.socket_canonname = "" if ( self.address_family == socket.AF_INET or self.address_family == socket.AF_INET6 ) and self.addrinfo._checkInfoById( self.address_family, self.socket_type, self.socket_proto, self.socket_canonname ): self.server_address = self.addrinfo._getServerAddressById( self.address_family, self.socket_type, self.socket_proto, self.socket_canonname ) else: self.server_address = server_address self.socket = socket.socket(self.address_family, self.socket_type, self.socket_proto) self.requestHandlerClass = requestHandlerClass self.serializerClass = serializerClass self.timeout = timeout self.activate = activate if activate: self.client_activate()