Beispiel #1
0
        public bool Connect(string IP,int puertol,string clave,int puertor)
        {
            m_ip = IPAddress.Parse(IP);
            if (puertor!=0)
                this.m_puertos=puertor;

            this.m_url="tcp://" + IP + ":" + this.m_puertos + "/InterfazRemota";
            this.m_puertor=puertor;

            System.Security.Cryptography.MD5 cripto=System.Security.Cryptography.MD5.Create();

            bool valor=false;
            try
            {
                m_lPhantChannel = new TcpClientChannel(props, provider);
                ChannelServices.RegisterChannel(m_lPhantChannel);
            }
            catch
            {
                DisConnect();
                if (m_lPhantChannel!=null)
                    ChannelServices.RegisterChannel(m_lPhantChannel);
                else
                    m_lPhantChannel = new TcpClientChannel(props, provider);
            }
            interfazremota = (CInterfaceGateway) Activator.GetObject(typeof(eLePhant.eDonkey.CInterfaceGateway),
                this.m_url);

            if (interfazremota == null)
                Debug.Write("No se pudo encontrar el servidor");
            else
            {
                //c = new byte[clave.Length];
                //for (int i=0;i<clave.Length;i++) c[i]=System.Convert.ToByte(clave[i]);
                //cripto.ComputeHash(c);
                //try
                //{
                valor = interfazremota.CheckPw( clave );
                /*}
                catch
                {
                    ChannelServices.UnregisterChannel(this.canalCeLephant);
                    this.canalCeLephant = null;
                    Debug.Write("\nNo se pudo encontrar el servidor\n");
                }*/
            }
            return valor;
        }
Beispiel #2
0
        public bool Connect(string IP,string clave,int puertor)
        {
            m_ip = IPAddress.Parse(IP);
            if (puertor!=0)
                this.m_puertos=puertor;

            this.m_url="tcp://" + IP + ":" + this.m_puertos + "/InterfazRemota";
            this.m_puertor=puertor;

            System.Security.Cryptography.MD5 cripto=System.Security.Cryptography.MD5.Create();

            bool valor=false;
            try
            {
                m_lPhantChannel = new TcpClientChannel(props, provider);
                ChannelServices.RegisterChannel(m_lPhantChannel);
            }
            catch
            {
                DisConnect();
                if (m_lPhantChannel!=null)
                    ChannelServices.RegisterChannel(m_lPhantChannel);
                else
                    m_lPhantChannel = new TcpClientChannel(props, provider);
            }
            interfazremota = (CInterfaceGateway) Activator.GetObject(typeof(eLePhant.eDonkey.CInterfaceGateway),
                this.m_url);

            if (interfazremota == null)
                Debug.Write("No se pudo encontrar el servidor");
            else
            {
                try
                {
                    valor = interfazremota.CheckPw( clave );
                }
                catch
                {
                    Debug.Write("\nNo se pudo encontrar el servidor\n");
                }
            }
            return valor;
        }