Exemplo n.º 1
0
        public void Connect()
        {
            try
            {
                m_tcpClient = new TcpClient(m_host, m_port);

                logger.Debug("XMPP client is connected to " + m_host + ":" + m_port + ".");

                m_tcpWrappedStream = new WrappedStream(m_tcpClient.GetStream());
                XMPPInitialStream initialStream = new XMPPInitialStream(m_tcpWrappedStream);
                initialStream.Start(m_server, null, null);

                m_tcpWrappedStream.BlockIO();
                XMPPStreamTLSRequired();
                m_sslWrappedStream.BlockIO();
                XMPPStreamAuthenticated();
            }
            catch (Exception excp)
            {
                logger.Error("Exception XMPPClient.Connect. " + excp.Message);
            }
            finally
            {
                if (Disconnected != null)
                {
                    Disconnected();
                }
            }
        }
Exemplo n.º 2
0
        private void XMPPStreamAuthenticated()
        {
            logger.Debug("XMPP client now authenticated as " + m_fromUsername + ", initiating binding.");

            m_authWrappedStream           = new WrappedStream(m_sslStream);
            m_authenticatedStream         = new XMPPAuthenticatedStream(m_authWrappedStream);
            m_authenticatedStream.IsBound = IsBound;
            m_authenticatedStream.Start(m_server, null, m_fromUsername);
        }
Exemplo n.º 3
0
        private void XMPPStreamTLSRequired()
        {
            logger.Debug("XMPP client initiating TLS connection.");

            m_sslStream              = new SslStream(m_tcpClient.GetStream(), false, ValidateServerCertificate, null);
            m_sslStream.ReadTimeout  = SSL_READWRITE_TIMEOUT;
            m_sslStream.WriteTimeout = SSL_READWRITE_TIMEOUT;
            m_sslStream.AuthenticateAsClient(m_server);
            m_sslWrappedStream = new WrappedStream(m_sslStream);
            XMPPEncryptedStream encryptedStream = new XMPPEncryptedStream(m_sslWrappedStream);

            encryptedStream.Start(m_server, m_saslToken, m_fromUsername);
        }
Exemplo n.º 4
0
        public void Connect()
        {
            try
            {
                m_tcpClient = new TcpClient(m_host, m_port);

                logger.Debug("XMPP client is connected to " + m_host + ":" + m_port + ".");

                m_tcpWrappedStream = new WrappedStream(m_tcpClient.GetStream(), m_traceStream);
                XMPPInitialStream initialStream = new XMPPInitialStream(m_tcpWrappedStream);
                initialStream.Start(m_server, null, null);

                m_tcpWrappedStream.BlockIO();
                XMPPStreamTLSRequired();
                m_sslWrappedStream.BlockIO();
                XMPPStreamAuthenticated();
            }
            catch (Exception excp)
            {
                logger.Error("Exception XMPPClient.Connect. " + excp.Message);
            }
            finally
            {
                if (Disconnected != null)
                {
                    Disconnected();
                }
            }
        }
Exemplo n.º 5
0
        private void XMPPStreamAuthenticated()
        {
            logger.Debug("XMPP client now authenticated as " + m_fromUsername + ", initiating binding.");

            m_authWrappedStream = new WrappedStream(m_sslStream, m_traceStream);
            m_authenticatedStream = new XMPPAuthenticatedStream(m_authWrappedStream);
            m_authenticatedStream.IsBound = IsBound;
            m_authenticatedStream.Start(m_server, null, m_fromUsername);
        }
Exemplo n.º 6
0
        private void XMPPStreamTLSRequired()
        {
            logger.Debug("XMPP client initiating TLS connection.");

            m_sslStream = new SslStream(m_tcpClient.GetStream(), false, ValidateServerCertificate, null);
            m_sslStream.ReadTimeout = SSL_READWRITE_TIMEOUT;
            m_sslStream.WriteTimeout = SSL_READWRITE_TIMEOUT;
            m_sslStream.AuthenticateAsClient(m_server);
            m_sslWrappedStream = new WrappedStream(m_sslStream, m_traceStream);
            XMPPEncryptedStream encryptedStream = new XMPPEncryptedStream(m_sslWrappedStream);
            encryptedStream.Start(m_server, m_saslToken, m_fromUsername);
        }