/// <summary>
        /// Disconnect socket
        /// </summary>
        private void Disconnect()
        {
            try
            {
                if (m_server != null)
                {
                    m_server.OnDisconnect(m_clientJid);
                }

                if (!streamFooterSent && m_Sock.Connected)
                {
                    Send("</stream:stream>");
                    streamFooterSent = true;
                }


                // return right away if have not created socket
                if (m_Sock == null)
                {
                    return;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("XmppServerConnection Exception {0}", e.ToString());
            }

            try
            {
                // first, shutdown the socket (when connected
                if (m_Sock.Connected)
                {
                    m_Sock.Shutdown(SocketShutdown.Both);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("XmppServerConnection Exception {0}", e.ToString());
            }
            try
            {
                // next, close the socket which terminates any pending
                // async operations
                m_Sock.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("XmppServerConnection Exception {0}", e.ToString());
            }

            if (Global.ServerConnections.ContainsKey(this._Jid))
            {
                Global.ServerConnections.Remove(this._Jid);
            }
        }