def connect(self, address=tuple(), use_ssl=False, force_starttls=True, disable_starttls=False): """Connect to the XMPP server. When no address is given, a SRV lookup for the server will be attempted. If that fails, the server user in the JID will be used. :param address: A tuple containing the server's host and port. :param use_tls: Indicates if TLS should be used for the connection. Defaults to ``True``. :param use_ssl: Indicates if the older SSL connection method should be used. Defaults to ``False``. """ # If an address was provided, disable using DNS SRV lookup; # otherwise, use the domain from the client JID with the standard # XMPP client port and allow SRV lookup. if address: self.dns_service = None else: address = (self.boundjid.host, 5222) self.dns_service = 'xmpp-client' return XMLStream.connect(self, address[0], address[1], use_ssl=use_ssl, force_starttls=force_starttls, disable_starttls=disable_starttls)
def connect(self, address=tuple(), use_ssl=False, force_starttls=True, disable_starttls=False): """Connect to the XMPP server. When no address is given, a SRV lookup for the server will be attempted. If that fails, the server user in the JID will be used. :param address: A tuple containing the server's host and port. :param reattempt: If ``True``, repeat attempting to connect if an error occurs. Defaults to ``True``. :param use_tls: Indicates if TLS should be used for the connection. Defaults to ``True``. :param use_ssl: Indicates if the older SSL connection method should be used. Defaults to ``False``. """ # If an address was provided, disable using DNS SRV lookup; # otherwise, use the domain from the client JID with the standard # XMPP client port and allow SRV lookup. if address: self.dns_service = None else: address = (self.boundjid.host, 5222) self.dns_service = 'xmpp-client' return XMLStream.connect(self, address[0], address[1], use_ssl=use_ssl, force_starttls=force_starttls, disable_starttls=disable_starttls)
def connect(self, host=None, port=None, use_ssl=False, use_tls=False, reattempt=True): """Connect to the server. Setting ``reattempt`` to ``True`` will cause connection attempts to be made every second until a successful connection is established. :param host: The name of the desired server for the connection. Defaults to :attr:`server_host`. :param port: Port to connect to on the server. Defauts to :attr:`server_port`. :param use_ssl: Flag indicating if SSL should be used by connecting directly to a port using SSL. :param use_tls: Flag indicating if TLS should be used, allowing for connecting to a port without using SSL immediately and later upgrading the connection. :param reattempt: Flag indicating if the socket should reconnect after disconnections. """ if host is None: host = self.server_host if port is None: port = self.server_port self.server_name = self.boundjid.host if use_tls: log.info("XEP-0114 components can not use TLS") log.debug("Connecting to %s:%s", host, port) return XMLStream.connect(self, host=host, port=port, use_ssl=use_ssl, use_tls=False, reattempt=reattempt)
def connect(self, host=None, port=None, use_ssl=False): """Connect to the server. :param host: The name of the desired server for the connection. Defaults to :attr:`server_host`. :param port: Port to connect to on the server. Defauts to :attr:`server_port`. :param use_ssl: Flag indicating if SSL should be used by connecting directly to a port using SSL. """ if host is None: host = self.server_host if port is None: port = self.server_port self.server_name = self.boundjid.host log.debug("Connecting to %s:%s", host, port) return XMLStream.connect(self, host=host, port=port, use_ssl=use_ssl)