2012年3月7日水曜日

VNC vs X

I already use my Android phone to do some light remote work. I use ConnectBot http://code.google.com/p/connectbot/ [google.com] to SSH into a remote workstation. For graphical apps, I set up port forwarding for VNC (there's a menu option for it in connectbot) and use AndroidVNC http://code.google.com/p/android-vnc-viewer/ [google.com]

I have my VNC server set to only accept connections from localhost (and it's firewalled, too), so that only connections which are forwarded and encrypted via SSH wind up being accepted. This way I get secure remote access, the VNC protocol tends to be less bandwidth-intensive than raw X, and it preserves my session in case I get disconnected.

VNC work different than X. With VNC you have to display the whole desktop, and with the xserver you have the choice of only displaying the app you need to run. I think windows just added this feature in their windows 2008 server and call it remote app. And I love this I got old computers that can't run some programs so I just made a shorcut to just run the one app via xserver, and you can't even tell the difference since to the client it feels like a local program.

X Protocol does not use more bandwidth than VNC. If anything, the opposite is (typically) true.

However, there are more round trips when starting an application when using X Protocol as compared to VNC. Latency is the performance killer for X Protocol, not bandwidth. This means applications may/will launch faster on VNC. NX (based on dxpc) short-circuits some X protocol requests, avoiding the latency issue. Typically, NX (FreeNX) performs as well as VNC.

With the "usual" X Servers in use these days, typically the Window Manager is run locally. Also, font resources and other (eg cursor) resources are local.

This means that X Protocol is faster when the application is running. For example, text needs only send the code-point and not the bitmap. (though compression is typically used for both over a slow link -- but something like "dxpc" is aware of X11 protocol, and can compress more quickly and efficiently for that case)

Also, the "look and feel" is that of your local desktop -- using VNC means an entire desktop is being rendered over the wire, while with X11, only a single application is rendered. Using VNC means more load on the application server, because graphics are rendered and then shipped. With X11 the graphics are rendered locally. This means that the application server doesn't have to maintain a virtual display for each client. This can save 1 to 3 megabytes per client. Along with rendering time.

VNC also allows the connection to be dropped and then restarted. X11 can do this, but it requires a proxy X11 server.

VNC allows for more platforms.

Conclusion -

You are correct.

(1) VNC over SSH is a very good solution, and is preferred for many applications.

(2) If bandwidth is very limited, FreeNX may be preferred if compatible with the client and server platforms and the application.

(3) For the best "desktop experience", FreeNX or X is preferred. The application appears as if running "natively".

X Server Now Available For Android

"The open-source X Server for Android has hit beta and is now available for download through the Android Market. On Australian networks at least, smartphones are assigned publicly-accessible IP addresses, so it should be possible to display many Linux applications on an Android smartphone simply by setting the DISPLAY environment variable to the phone's IP address followed by :0"
The source is available under the MIT license over at Google Code (http://code.google.com/p/android-xserver/). It doesn't support all of the X protocol and there's no Xlib implementation (i.e. no X11 apps on the device yet except via the NDK if you're lucky), but it is a reimplementation of the X server in Java for Android. You can run remote applications at least.