发起远程VNC主机

时间:2018-08-21 22:35:26

标签: c# vnc vnc-server

我在C#中找到了一个很棒的VNC小库,其中有一个服务器和查看器:https://github.com/qmfrederik/remoteviewing

过去(6年前)我使用过UVNC SingleClick,它允许用户单击图标,然后启动主机并发出连接请求。该请求将到达通过防火墙路由的我的公共IP,最后在我的PC上显示一个弹出窗口,提示“ XXX想连接”,这将使我开始远程控制会话。

使用这个新库,我正在考虑将其集成到我自己的应用程序中,但是不确定如何启动会话。我计划安装一个公共的Linux VNC中继器,这使我想知道如何远程启动会话。

示例应用的外观如下:

    private static void Main(string[] args)
    {
        Console.WriteLine("Listening on local port 5900.");
        Console.WriteLine("Try to connect! The password is: {0}", password);

        // Wait for a connection.
        var listener = new TcpListener(IPAddress.Any, 5900);
        listener.Start();
        var client = listener.AcceptTcpClient();

        // Set up a framebuffer and options.
        var options = new VncServerSessionOptions();
        options.AuthenticationMethod = AuthenticationMethod.Password;

        // Virtual mouse
        var mouse = new VncMouse();

        // Create a session.
        session = new VncServerSession();
        session.Connected += HandleConnected;
        session.ConnectionFailed += HandleConnectionFailed;
        session.Closed += HandleClosed;
        session.PasswordProvided += HandlePasswordProvided;
        session.SetFramebufferSource(new VncScreenFramebufferSource("Hello World", Screen.PrimaryScreen));
        session.PointerChanged += mouse.OnMouseUpdate;
        session.Connect(client.GetStream(), options);

        // Let's go.
        Application.Run();
    }

以某种方式,我不必等待TCPListener,而要使其连接到VNC中继器并为其指定一个ID。一旦它向中继器显示了ID,我想它会在几秒钟后超时,观众可以使用ID进行连接

https://translate.google.com/translate?hl=en&sl=pt&u=https://cuidadodigital.com.br/ultravnc-sc-single-click-com-repeater-centos-7/&prev=search

0 个答案:

没有答案