Esempio n. 1
0
        protected override void OnConnected(bool bSuccess, string strErrors)
        {
            if (bSuccess == true)
            {
                this.Client.NoDelay  = true;
                XMPPClient.XMPPState = XMPPState.Connected;
                XMPPClient.FireConnectAttemptFinished(true);
                System.Diagnostics.Debug.WriteLine(string.Format("Successful TCP connection"));
            }
            else
            {
                XMPPClient.XMPPState = XMPPState.Unknown;
                XMPPClient.FireConnectAttemptFinished(false);
                System.Diagnostics.Debug.WriteLine(string.Format("Failed to connect: {0}", strErrors));
                return;
            }

            if (XMPPClient.UseOldStyleTLS == true)
            {
                StartTLS();
            }


            /// Send stream header if we haven't yet
            XMPPClient.XMPPState = XMPPState.Authenticating;

            OpenStreamStanza open    = new OpenStreamStanza(this.XMPPClient);
            string           strSend = open.XML;

            byte[] bStanza = System.Text.UTF8Encoding.UTF8.GetBytes(strSend);
            this.Send(bStanza);
        }