Giter VIP home page Giter VIP logo

remoteviewing's Introduction

RemoteViewing (Quamotion branch)

Build status

RemoteViewing is a .NET-native VNC client and server library.

You can use RemoteViewing to write your own VNC server or client.

It supports Raw, Hextile, Copyrect, and Zlib encodings, and includes a Windows Forms control to make embedding VNC in your program extremely easy.

RemoteViewing uses the BSD license.

Installation

Install using the command line:

Install-Package Quamotion.RemoteViewing

Samples

This repository contains three sample projects:

  • RemoteViewing.NoVncExample implements a noVNC server using RemoteViewing. The server itself is implemented using ASP.NET Core
  • RemoteViewing.ServerExample implements a VNC server which allows you to share your desktop
  • RemoteViewing.Example implements a VNC client using Windows Forms.

Credits

The code in this repository is based on the download available at http://www.zer7.com/software/remoteviewing

remoteviewing's People

Contributors

bartsaintgermain avatar dependabot[bot] avatar kekekeks avatar qmfrederik avatar tftomsun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remoteviewing's Issues

Provide example for VncAviWriter

Hi, can you please provide an example how to use and record video using VncAviWriter, currently i manage to get 200mb file after 5 seconds recording with no data. And how to pass video stream to ffmpeg?

Cannot connect to the server from client

Hi
I have built the project without any modification and tried to connect to the server from client (RemoteViewing.Example). The port 5900 is open in the server and I am connecting within local network. But it throws error
System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.50.101:5900.
What could be the issue?

RFB 3.8 not supported by server

RFB is probably supported by my server. Is there a way to check whether it is actually not supported or if I'm doing something wrong?

high CPU usage from the server

Hello. I am experience a very heavy CPU usage from the server. Is there a way to fix this issue somehow ?
( any example would be great :)

Use the NoVNC example

Hello,
How can I use the NoVNC example?
Where are the scripts files located? When I run the example project i get these errors:
404 (Not Found) on util.js file
404 (Not Found) on base.css file

Thanks,
Frederico

Bit depth of 16

Hi,

I am trying to use the VncClient class against a Tight VNC server version 2.8.8.

It gives me an exception stating the pixelFormat is invalid. When I read the raw value by looking at the source code I see thtat TightVNC is sending a bit depth of 16. The code throws an exception if it is not 24.

It does connect but I all see is a black screen.

Can this be resolved? thoughts?

Build issue in VS2019

Hi, hoping you can help me

Trying to build project in VS 2019 (which is fully updated etc), but getting the errors below which I don't understand how to resolve:-

image

Opening in VS2015

Dear all,
I recentrly updated my local copy of the source code, and I'm not able to open the solution in vs2015. I get the following error (sorry it is in Italian, I tried to translate it in English below):

 lo spazio dei nomi XML predefinito del progetto deve essere lo spazio dei nomi XML di MSBuild. Se il progetto viene modificato nel formato MSBuild 2003, aggiungere xmlns="http://schemas.microsoft.com/developer/msbuild/2003" all'elemento <Project>. Se il progetto è stato modificato nel formato precedente 1.0 o 1.2, convertilo al formato MSBuild 2003. 

TRANSLATION:
The predefined XML namespace must be the MSBuild XML namespace. If the project is modified into MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> item. If the project has been modified from the previous formats 1.0 or 1.2, convert it to MSBuild 2003 format.

Can you help? In which version of VS are you working?

Mono support

Hi is this library mono compatible? Can i build cross platform vnc viewer?

Permission to use dll

Hi I’d like to use your dll in one of my project you can check it on github LightCosmosRat a remote administration tool for windows.

Cannot compile in VS2015

I'm trying to compile this interesting project in VS2015 Community, but I cannot do it since the project RemoteViewing.Windows.Forms cannot compile, it says the RemoteViewing DLL is missing, but it is correctly referenced.
I've already tried to reference again the DLL file directly or the RemoteViewing project, nothing changes.
Any clue on that?

Multiple clients at once

Hi,

Does this library support multiple clients connected at the same time, and if so, what is the correct way to do it?
Is it the Session.Connect() function that has to be started on a newly spawned thread for each new incoming client? That is more or less the way I tried to do it yesterday, but that did not seem to work. I can provide the code if necessary, but I was mainly wondering if this is possible at all with this libary.

Kind regards,
LJ

Support for on demand frame buffer request

Hello,
thanks for the effort that you already put into that component. Would you mind to offer the possibility to do the communication manual without a always running thread?

Background: I don't want to poll all the time for image updates and cut the regions of interest. I would like to get frames on demand of specific regions.
What would be necessary:

  • possibility to suppress the start of the polling thread
    public access to Functions like:
    SendFrameBufferUpdateRequest (incl. the possibility to pass the rectangle that is of interest)
    HandleFrameBufferUpdate which returns the image data of the requested region

or better, one function that does that all in a synchronous way:

byte[] LoadFrameBufferRectangle(Rectangle boundsOfInterest)

Best regards, Tom

Password Skipped

While running the ServerSample, I've set the Password but the client just skip the authorization. And swap the sequence of checking Password and Reverse in the VncServerWorker.cs works it out.

cursor lagging and blinking

i am not really familiar with VNC and the configration possibilities of the VncClient but your example seems to be laggy

SIZE VNC FRAME

Good evening, is it possible to adjust the size of the remote capture to the container?

2020-03-27_2259

No keyboard or mouse

Hello , Thanks for your work .. i test your server example but no keyboard or mouse is working .. is that normal ? is there any option to enable this? or is it default to be viewonly ? any option to accept remote input ?

Thanks

Can I Use Two VncControl In Winform

When I Use Two VncControl In Winform, It Throw Exception as 'System.InvalidOperationException: You cannot call invoke or BeginInvoke on a control until you create a window handle.'

VncControl do not release memory after calling Dispose()

VncControl do not release memory after calling Dispose()

This lead to over memory use if the control is created and then dispose multi times during the application is running.

Look like it is not an issue of my code (remaining reference etc..) because i tested with other controls using the same logic and they all release the memory after calling the dispose() function .

Exept this remark, this control is the best i have found for c#. Thank you for the nice work!

Is it meant to be this slow?

When connecting via RealVNC viewer, it stays on the same frame for so long, and its very confusing. If this is a code issue, here's my code for the VNC Server.
`using RemoteViewing.Vnc;
using RemoteViewing.Vnc.Server;
using RemoteViewing.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace VM_Battle_Royale
{
public delegate Rectangle VncScreenFramebufferSourceGetBoundsCallback();
///
public class VncScreenFramebufferSource : IVncFramebufferSource, IVncRemoteKeyboard, IVncRemoteController
{
VncMouse mouse = new VncMouse();
private Bitmap bitmap;
private VncFramebuffer framebuffer;
private string name;
private VncScreenFramebufferSourceGetBoundsCallback getScreenBounds;

    /// <summary>
    /// Initializes a new instance of the <see cref="VncScreenFramebufferSource"/> class.
    /// </summary>
    /// <param name="name">The framebuffer name. Many VNC clients set their titlebar to this name.</param>
    /// <param name="screen">The bounds of the screen region.</param>
    public VncScreenFramebufferSource(string name, Screen screen)
    {
        if (screen == null)
        {
            throw new ArgumentNullException(nameof(screen));
        }

        this.name = name ?? throw new ArgumentNullException(nameof(name));
        this.getScreenBounds = () => screen.Bounds;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="VncScreenFramebufferSource"/> class.
    /// Screen region bounds are determined by a callback.
    /// </summary>
    /// <param name="name">The framebuffer name. Many VNC clients set their titlebar to this name.</param>
    /// <param name="getBoundsCallback">A callback supplying the bounds of the screen region to copy.</param>
    public VncScreenFramebufferSource(string name, VncScreenFramebufferSourceGetBoundsCallback getBoundsCallback)
    {
        this.name = name ?? throw new ArgumentNullException(nameof(name));
        this.getScreenBounds = getBoundsCallback ?? throw new ArgumentNullException(nameof(getBoundsCallback));
    }

    /// <inheritdoc/>
    public bool SupportsResizing => false;

    /// <inheritdoc/>
    public ExtendedDesktopSizeStatus SetDesktopSize(int width, int height)
    {
        return ExtendedDesktopSizeStatus.Prohibited;
    }

    /// <summary>
    /// Captures the screen.
    /// </summary>
    /// <returns>A framebuffer corresponding to the screen.</returns>
    public VncFramebuffer Capture()
    {
        var bounds = this.getScreenBounds();
        int w = bounds.Width, h = bounds.Height;

        if (this.bitmap == null || this.bitmap.Width != w || this.bitmap.Height != h)
        {
            this.bitmap = new Bitmap(w, h);
            this.framebuffer = new VncFramebuffer(this.name, w, h, new VncPixelFormat());
        }

        using (var g = Graphics.FromImage(this.bitmap))
        {
            g.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size);

            lock (this.framebuffer.SyncRoot)
            {
                VncBitmap.CopyToFramebuffer(
                    this.bitmap,
                    new VncRectangle(0, 0, w, h),
                    this.framebuffer,
                    0,
                    0);
            }
        }

        return this.framebuffer;
    }

    public void HandleKeyEvent(object sender, KeyChangedEventArgs e)
    {
       
    }

    public void HandleTouchEvent(object sender, PointerChangedEventArgs e)
    {
        mouse.OnMouseUpdate(sender, e);  
    }
}

}
`

Unable to scale client

Hi, Sorry if its just an issue with what i am doing but i am struggling to get the client to scale to the user control it is in, i can do the scroll bars but is it possible to scale the control window if the resolution is bigger than the user control?

Logger ArgumentNullException VncServerSession

Hi,

I'm running a VncServerSession and when a client disconnects I get a:
System.ArgumentNullException: 'Value cannot be null. (Parameter 'logger')

Stacktrace:
Microsoft.Extensions.Logging.Abstractions.dll!Microsoft.Extensions.Logging.LoggerExtensions.Log(Microsoft.Extensions.Logging.ILogger logger, Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, System.Exception exception, string message, object[] args RemoteViewing.dll!RemoteViewing.Vnc.Server.VncServerSession.OnClosed() RemoteViewing.dll!RemoteViewing.Vnc.Server.VncServerSession.ThreadMain() System.Private.CoreLib.dll!System.Threading.Thread.StartCallback()

I use the parameterless VncServerSession constructor that isn't passed a Ilogger implementation.
On a quick glance it looks like OnClosed method is missing a null check for the logger?

Have host connect through repeater

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

UnsupportedPixelFormat bitDepth=16

First of all, thank you for this awesome project. The implementation is great.

After testing the library with different servers and devices I got a UnsupportedPixelFormat error. I attached the debugger and these are the locals of VncPixelFormat constructor

		bitsPerPixel	16	int
		bitDepth	16	int
		redBits		5	int
		redShift	11	int
		greenBits	6	int
		greenShift	5	int
		blueBits	5	int
		blueShift	0	int
		isLittleEndian	true	bool
		isPalettized	false	bool

Could I know a bit more why bitDepth=16 is not supported. If I understand it, I may be able to contribute to this project.

No support for lowercase keys in WinForms client.

There does not appear to be support for lowercase characters when using the WinForms VncClient. This client traps the key UP and DOWN events which only deal with KeyEventArgs. Unfortunately KeyEventArgs only provides a key code and does not distinguish between upper and lower case inputs. The result is that SendKeyUpdate(...) always sends an uppercase letter to the remote server. A simple work around could possibly be to make use of the key PRESS event.

VNC working only with RAW encoding

I've tried to conenct to the server with other encoding ( I removed raw encoding from client's encoding list) but it still use RAW (???)

Clipboard Sharing and Keyboard

Hello. Thank you for this code. I need help. Could you help me with clipboard sharing and keyboard. They do not work with examples and no matter how I try to do something, it does not work. I would be very grateful if you help me.

Performance

Hi,

In its current state remoteviewing cannot compete with other VNC servers like TightVNC or RealVNC when it comes to speed. When using TightVNC I can clearly notice that it is more responsive then when using the ServerExample from remoteviewing.

What is causing this and can we do something to improve this?
Is this caused by the fact that the major VNC servers are native code and not managed like RemoteViewing?
Do they use more efficient encodings that remoteviewing does not support?
Does remoteviewing simply need some optimization?
Or of course a combination of a all/a subset of the above?

So my question is: are you aware of any issues that may explain the lack of performance compared to TightVNC? And can we implement improvements?

Kind regards,
LJ

VncScreenFramebufferSource is not available in the NuGet package.

I'm trying to implement a VNC server into my app.

The example RemoteViewing.ServerExample is not bad, but not a working server.

While hunting a solution, I found in the VncScreenFramebufferSource in the namespace RemoteViewing.Windows.Forms.Server.

But this is not compiled inside the NuGet package. I believe the reason for this is the compiler directive #if NET461 in line 29 of VncScreenFramebufferSource.cs.

Is this a bug?

VNC Client doesn't work on Blazor Web Assembly (Socket not avaible in the browser)

In a Blazor Web Assembly net5.0 project

When calling the method:
public void Connect(string hostname, int port = 5900, VncClientConnectOptions options = null);
From the class RemoteViewing.Vnc.VncClient

It throws the exception: System.PlatformNotSupportedException: System.Net.Sockets is not supported on this platform.
image

Because Sockets are not supported in a web browser

Is there any way to connect to a VNC server using this library?
I am thinking of using the following method:
public void Connect(Stream stream, VncClientConnectOptions options = null);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.