private void ProcessBind(Iq iq)
        {
            var bind = iq.Query as Bind;

            string res = bind.Resource;

            if (!String.IsNullOrEmpty(res))
            {
                var jid = new Jid(User, XmppDomain, res);
                _Jid = jid;
                var resIq = new BindIq
                {
                    Id   = iq.Id,
                    Type = IqType.Result,
                    Bind = { Jid = jid }
                };

                Send(resIq);
                Resource = res;
                IsBinded = true;

                // connection is bindet now. Add it to our global list of connection.
                if (!Global.ServerConnections.ContainsKey(this._Jid))
                {
                    Global.ServerConnections[this._Jid] = this;
                    m_server.OnConnect(this._Jid);
                }
                //else
                //  Global.ServerConnections.Add(this._Jid, this);


                // Wait until we receive the HANDSHAKE message

                //if (m_server != null)
                //{
                //    m_server.OnConnect(m_clientJid);
                //}
            }
            else
            {
                // return error
            }
        }