Exemple #1
0
 public bool Connect(string IP,int port3,string key,int port2)
 {
     m_ip = IPAddress.Parse(IP);
     if (port2!=0)
     this.m_Port=port2;
     this.m_url="tcp://" + IP + ":" + this.m_Port + "/RemoteInterface";
     this.m_Port2=port2;
     System.Security.Cryptography.MD5 cripto=System.Security.Cryptography.MD5.Create();
     bool valor=false;
     try
     {
     m_lPhantChannel = new TcpClientChannel(props, provider);
     ChannelServices.RegisterChannel(m_lPhantChannel, true);
     }
     catch
     {
     DisConnect();
     if (m_lPhantChannel!=null)
         ChannelServices.RegisterChannel(m_lPhantChannel, true);
     else
         m_lPhantChannel = new TcpClientChannel(props, provider);
     }
     remoteInterface = (CInterfaceGateway) Activator.GetObject(typeof(CInterfaceGateway),
                  this.m_url);
     if (remoteInterface == null)
     Debug.Write("Could not locate the server");
     else
     {
     //c = new byte[key.Length];
     //for (int i=0;i<key.Length;i++) c[i]=System.Convert.ToByte(key[i]);
     //cripto.ComputeHash(c);
     //try
     //{
     valor = remoteInterface.CheckPw( key );
     /*}
     catch
     {
         ChannelServices.UnregisterChannel(this.canalCeLephant);
         this.canalCeLephant = null;
         Debug.Write("\nNo se pudo encontrar el servidor\n");
     }*/
     }
     return valor;
 }
Exemple #2
0
 public bool Connect(string IP,string key,int port2)
 {
     m_ip = IPAddress.Parse(IP);
     if (port2!=0)
     this.m_Port=port2;
     this.m_url="tcp://" + IP + ":" + this.m_Port + "/RemoteInterface";
     this.m_Port2=port2;
     System.Security.Cryptography.MD5 cripto=System.Security.Cryptography.MD5.Create();
     bool valor=false;
     try
     {
     m_lPhantChannel = new TcpClientChannel(props, provider);
     ChannelServices.RegisterChannel(m_lPhantChannel, true);
     }
     catch
     {
     DisConnect();
     if (m_lPhantChannel!=null)
         ChannelServices.RegisterChannel(m_lPhantChannel, true);
     else
         m_lPhantChannel = new TcpClientChannel(props, provider);
     }
     remoteInterface = (CInterfaceGateway) Activator.GetObject(typeof(CInterfaceGateway),
                  this.m_url);
     if (remoteInterface == null)
     Debug.Write("Could not locate the server");
     else
     {
     try
     {
         valor = remoteInterface.CheckPw( key );
     }
     catch
     {
         Debug.Write("\nCould not locate the server\n");
     }
     }
     return valor;
 }