Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Have host connect through repeater #37

Open
ajhalls opened this issue Aug 21, 2018 · 0 comments
Open

Have host connect through repeater #37

ajhalls opened this issue Aug 21, 2018 · 0 comments

Comments

@ajhalls
Copy link

ajhalls commented Aug 21, 2018

Thank you for a great little VNC library.

I have used in the past (6+years ago) the UVNC SingleClick which lets a user click an icon and it starts the host and sends out a request to connect. That request would go to my public IP routed through the firewall and end up at my PC with a popup that would say "XXX wants to connect", which would let me start a remote control session.

With this new library, I was thinking of just integrating it into my own application, but wasn't sure how to initiate the session. I plan on having a public linux VNC repeater. Within my app there is regular communication with a server and I can pass back variables which can trigger a function, but I don't know what to do here to start initiating a session through a repeater from the host

Here is how the sample included app looks:

    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();
    }

Somehow I need to not wait for the TCPListener, but to have it, when triggered by another event, connect to the VNC Repeater and give itself an ID. Once it presents it's ID to the repeater I imagine there would just be a number of seconds that the viewer could connect using the ID before it times out.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant