Squeak and VNC
Last updated at 6:43 pm UTC on 22 November 2023
About VNC
VNC is a protocol for remote display (and control) of an X-Windows / Win / Mac desktop. So why not use it to control your Squeak desktop as well? This would be ideal for
- remote administration of a Swiki
- teaching, as VNC allows multiple users to share a session
- embedded Squeak (Squeak in your CD player or missile control system, anyone?)
- who knows?
The software consists of two parts: the VNC server (keeps your desktop, and sends update information on request) and the viewer for displaying the desktop. VNC viewers are available for most platforms: (Mac, Windows, Unix, etc). The server recognizes changes on the desktop and sends bitmaps with these changes to the client(s).
The home page for VNC is at http://realvnc.com/ run by the people that originally created VNC at Olliveti labs in Cambridge UK.
How to use Squeak via VNC
You will find the original version of the Squeak VNC package at http://www.squeaksource.com/RFB (RFB = Remote Frame Buffer protocol) but we strongly recommend using the newer version at http://source.squeak.org/ss (look for RFB-cmm.20.mcz or newer)
See the class comment of class RFBServer for some documentation. Note that the comment was written by Ian Piumarta in 2004 when he wrote the original version and computer performance has improved by quite a large factor since then, so some recommendations may no longer apply. The server and viewer apps are automatically added to the apps menu on the dock for easy access.
As of late 2023 and the Squeak 6.1 trunk image, there seem to be some issues that could do with attention. Some attempts at detecting the causes and fixing them lead to the following observations
- the viewer makes one DNS call to resolve the name of the server (ie MyBigServer.com or fred.local etc)
- the server uses one DNS call to derive the peer name of the client machine for logging purposes
- when running both systems on the same machine the server defaults to using the Raw encoding which is computationally fast but communication heavy.
- when running across two separate machines the current code defaults to hextile encoding, which seems to cause some serious startup time issues. Profiling and debugging might be useful here
- the ZRLE encoding turns out to be very useful because
- it appears to work very quickly on modern machines
- it works well with the Remmina VNC client. Sadly this seems to be linux-only, and all the other VNC clients tested failed to connect to the Squeak server properly; this is sad
- somebody skilled in the use of tools such as WireShark might be able to help work out where the apparent occasioanl delays in communication come from
Old and obsolete notes that still contain some possible value
For example, it doesn't appear that any java-in-web-browser vncclient still exists. There is the NoVNC javascript based client that ought to be usable.
Rough notes from #squeak:
gokr: you can fire up a VNC.
gokr: Squeak works fine with VNC.
gokr: But then again - you built it headless...
water: yeah, he'll have to build an image on a headed vm
water: and send it to where the headless vm is, and run it there
gokr: Yup. Or do it all "in a dark room".
16:11
sm: no I built it headed.. just running it with -headless
water: which should be avoided until you have a lot of experience with headless work
gokr: Aha!
water: oh, ok
sm: accidental.. but that's what I did
water: yeah just run it normally with remote-X or VNC
gokr: Good then. Install vnc, start the vnc with "vncserver -cc 3" and off you go.
gokr: Familiar with VNC?
sm: I've used it.. I'm not sure how it will work here, yet
sm: will squeak think X is running ?
gokr: Yup.
sm: and did you mean install vnc locally, on server, or in squeak image ?
gokr: The "-cc 3" is needed though.
gokr: You install the vnc server part on the machine with no X.
gokr: Fire it up - this will start an X server that Squeak will think is a fine X display.
gokr: Then you connect to that from another machine using the vncviewer.
gokr: But just so you know - you don't need any vnc package to get it working. It is just that people have implemented the vnc protocol in Squeak too.
water: oh, right
sm: gokr: I don't understand what you just said
sm: ie there's a vnc server which could run in squeak ?
16:21
gokr: Think so. Have never tried it.
water: yes there is
water: it's not too shabby
water: but not designed for what you're doing
sm: ok.. so I could install that and connect vnc client directly to squeak
water: i don't know
water: but i suggest you take goran's advice
water: since that's more reliable
gokr: http://map1.squeakfoundation.org/sm/packagebyname/vnc
sm: but for now I'll be connecting to a standalone vnc server, which will act as X server to squeak
gokr: Exactly.
VNC package on Squeakmap: http://map1.squeakfoundation.org/sm/packagebyname/vnc
The RemoteFrameBuffer package (aka VNC) is now here (link changed due to an update of SqueakMap?): http://map1.squeakfoundation.org/sm/package/d4f692a8-c7fa-4d49-927f-74aba7e8fd83
More on VNC setup, for running squeak on a hosted server account
My server is a freebsd jail. I previously built squeak there - full squeak, not headless - after installing the necessary X11 libraries from ports (I think now I could have installed a package).
Today I installed vnc and the X11 clients via packages. Mark Schwenk said:
mschwenk: I'm not sure what the default scripts do there. But basically to start one up by hand requires the following...
Error: this should not happensm listens
mschwenk: you need to figure out a user to run as. LIke yourself or a new user, say "squeak"
mschwenk: then login as that user. Create a .vnc directory in their home.
mschwenk: then change into that directory and run vncpasswd to create a password for that user.
(snip...)
mschwenk: You should then be able to connect to that desktop by using your vncclient to connect to hostname:1
mschwenk: assuming no firewalls, etc.
mschwenk: It's best not to leave open for general access, so firewall based on ip is one option. Or use ssh to tunnel your connection to your box via ss.
mschwenk: ssl.
I did the vncpasswd thing. Next, (all as the squeak user) I ran "vncserver" and it set up a default xstartup for me. I think I then had to run it a second time, before seeing an Xvnc process running. My host is now listening for VNC connections.
On my local machine, I installed a VNC client. On debian gnu/linux, that goes like this:
apt-get install xvncviewer
and then:
xvncviewer server.host::5901
got me a password prompt and the X desktop! It seemed necessary to specify the port, perhaps debian and freebsd disagree on the default.
Using this, I ftp'd the latest squeak image and sources and unpacked them in /home/squeak, then ran squeak. Hurrah! Server squeak, displaying on my local desktop.
More:
You can connect with a vnc client on port 5901, or java-enabled web browser on 5801.
Doing it more securely over SSH:
pr3d4t3ur: sm: You can also use SSH tunneling to connect to VNC. That's what I do to talk to my machines which aren't on-site.
sm: pr3d4t3ur: would you have a recipe handy ? I'd like to do this more securely
pr3d4t3ur: sm: Easy as cake, piece of pie. On your client, run SSH and tell it that you want to forward local port 5901 to the same port on the remote machine after you connect. Then you run VNC connecting to localhost:1 and that's it.
pr3d4t3ur: sm: How you tell SSH to forward is dependent on your SSH client. PuTTY does it from a dialog box, NIX normally over the command line.
sm: cool.. let me try
pr3d4t3ur: sm: So man ssh – I think the syntax is something like ssh -L5901:5901 -l pr3d4t3ur to.somehost.com
sm: thanks
sm: so I quit the vnc viewer and fired it up again, and of course my x session is still thereError: this should not happensm giggles.. ignore me
This worked for me:
ssh -l squeak -L5901:serverhost:5901 serverhost
It seemed a bit slower, adding the -C options seemed to help (this is over a DSL connection). For more on this see http://www.uk.research.att.com/archive/vnc/sshvnc.html ,
http://www.eugeneciurana.com/personal/ssh_ssl_how-to.html