Exemplo n.º 1
0
        public override Server creack(String ip, int port, String username, String password, int timeOut)
        {
            VncClient vc     = null;
            Server    server = new Server();

            try
            {
                vc = new VncClient();

                Boolean result = vc.Connect(ip, 0, port);
                if (result)
                {
                    server.isSuccess = vc.Authenticate(password);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally {
                if (vc != null)
                {
                    vc.Disconnect();
                }
            }
            return(server);
        }
Exemplo n.º 2
0
 private void TestConfig(MainWindowViewModel vm)
 {
     using (var client = new VncClient(config.BitsPerPixel, config.Depth))
     {
         try
         {
             client.Connect(vm.Host, vm.Port);
             client.Authenticate(new VncAuthenticator(vm.Password));
             client.Disconnect();
             MessageBox.Show("OK.", "Config", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         catch (SocketException e)
         {
             MessageBox.Show(e.Message, Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
         }
         catch (VncSecurityException e)
         {
             MessageBox.Show(e.Message, Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
         }
         catch (Exception e)
         {
             MessageBox.Show($"{e.Message}\r\n{e.StackTrace}", Strings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Stops the remote host from sending further updates and disconnects.
 /// </summary>
 /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is not already in
 /// the Connected state. See <see cref="IsConnected" />.</exception>
 public void Disconnect()
 {
     InsureConnection(true);
     vnc.ConnectionLost -= VncClientConnectionLost;
     vnc.ServerCutText  -= VncServerCutText;
     vnc.Disconnect();
     SetState(RuntimeState.Disconnected);
     OnConnectionLost();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Stops the remote host from sending further updates and disconnects.
 /// </summary>
 /// <exception cref="System.InvalidOperationException">Thrown if the RemoteDesktop control is not already in the Connected state. See <see cref="VncSharp.RemoteDesktop.IsConnected" />.</exception>
 public void Disconnect()
 {
     InsureConnection(true);
     vnc.ConnectionLost -= new EventHandler(VncClientConnectionLost);
     vnc.ServerCutText  -= new EventHandler(VncServerCutText);
     vnc.Disconnect();
     SetState(RuntimeState.Disconnected);
     OnConnectionLost();
     Invalidate();
 }