I've looked at NoMachine NX a
couple of times before but never really got down to the nitty gritty
details about how the thing works. This time I was determined to figure
it out and I've written it
down.
I've looked at NoMachine NX a
couple of times before but never really got down to the nitty gritty
details about how the thing works. This time I was determined to figure
it out and I've written it
down.
The work Caolan and I have been doing on terminal services over
VNC is part of a bigger picture plan to really start making
VNC useful across all "remote desktop" use cases.
Here's a writeup
of the use cases and how the thing will work.
So, I've got working patches now for TLS/SSL support in the
C++
and
Java VNC
clients. That was all pretty boring since I'd already
(months ago) written a bunch of test code with
GNU TLS and the
Java Secure Socket Extension.
I'm sure there's a moral to that, but I can't quite put my finger on
it ...
Thanks to Tim Waugh, before we even started, we knew one of the
stumbling
blocks for this terminal services thing was going to be VNC's ZRLE
encoding.
You see, in order to make the hot-desking thing work you need to be
able
to transfer a VNC client between two VNC servers without the client
knowing
about it.
What makes the ZRLE encoding difficult is that it compresses the pixel
stream using zlib and this introduces state into the VNC stream. A
rectangle
of encoded pixel data now depends on the pixels that went before. So
when,
you transfer a client between servers, the new server either needs to
know
the state of the zlib stream or you need to allow the new server to
start
with a clean slate somehow.
A glance at the zlib docs
and the Z_FULL_FLUSH/Z_FINISH deflate() flags jumped out
of me. Sweet, this is going to be trivial, says he. Like a good
engineer,
I started writing a
test case to prove the
idea. The solution wasn't as obvious as I'd hoped,
though, and I found myself knee deep in docs, rfcs and the inflate()/
deflate() code. Unfortunately, I had to actually understand
what the hell was going on. The horror!
Plugged the code into Xvnc and tried it out. Broken. Dramatically
broken. Debug,
tweak, test. Still broken. And on it went. Eventually, hours later, I
went back
to my test case and discovered that it actually wasn't working. It was
sneakily
pretending to be working. But it wasn't. Trivial fix and all is well.
You can save so much time by figuring stuff out in a small test case
rather
than trying to figure it out in the context of a huge mass of code with
a million
and one other things happening. I know this to be true, and as time goes
on
I'm learning just how true it is. But you still find yourself launching
headlong
into problems thinking "it looks trivial, in the same time I'd write a
test case
I'll have the thing fixed" and only hours and hours later do you get a
clue
and start writing a test case. I get the feeling Owen always reaches
straight
for a test case. Maybe that's his secret :-)
Anyway, I've moved on to adding TLS/SSL support Xvnc and vncviewer now.
And,
yes, I'm going to go through all this "state flushing" pain again. Fun
all the way, I tell ya ... Now, where's my test case?
On the plus side, I've had to take loads of breaks from this stuff
today,
and I've been cooking. Had a gorgeous
ratatouille for lunch
and some chilli
is bubbling away as I type.
He Calls Himself an Irishman?
So, Glynn's a posh
D4 Dubliner. Don't mind him. Most of us Waterford knackers with
a bit of national pride think Ireland's
Call is an abomination
and that Ireland is losing some of
its national identity by not using Amhrán na
bhFiann for rugby.
It has one great side effect, though. Everyone can now actually
understand what they're singing! You won't find many irishmen
who are fluent enough in their national language enough to be
able to translate this:
Sinne Fianna Fáil
A tá fé gheall ag Éirinn,
buion dár slua
Thar toinn do ráinig chugainn,
Fé mhóid bheith saor.
Sean tír ár sinsir feasta
Ní fhagfar fé'n tiorán ná fé'n tráil
Anocht a théam sa bhearna bhaoil,
Le gean ar Ghaeil chun báis nó saoil
Le guna screach fé lámhach na bpiléar
Seo libh canaídh Amhrán na bhFiann.
Watch closely next time you see an Irish sports team during
their national anthem. Count with your fingers how many of
the players are actually singing rather than humming, swaying
from side to side and generally looking embarrassed. You
won't need your other hand ...