Android VNC server?

1348 views
Skip to first unread message

Josh Guilfoyle

unread,
Dec 23, 2007, 12:25:44 AM12/23/07
to Android Developers
I had a thought to create a VNC server for Android so that I could
connect my Windows Mobile smartphone to the Android emulator via the
sync cable and thus test the usability of some of my developing
programs without actually having installed the firmware anywhere. I
started tinkering with creating this server myself but quickly
discovered that port 5900 is already bound inside the emulator, with
apparently a functional protocol implemented that identifies the
desktop as "Android RFB".

My first thought was to redirect the ports (using redir add tcp:
5900:5900) and connect locally, but in that case the server
immediately rejects the connection with no reason given. I tried
connecting inside the emulator and was able to manually simulate the
first part of the protocol, which tells me that the rejection was
caused by some trivial authentication/host problem.

My question is two part:

1) Has Google produced a custom Android-specific RFB implementation?
How can we access this as developers? This would be extremely useful!

2) Is this simply QEMU's built-in VNC server support being sloppily
left open inside of Android? I tried running emulator -qemu -vnc 0
but was not impressed by the functionality of the built-in VNC
server. It seems quite broken (no keyboard input, strange display
bitmaps, etc), however I noticed that the desktop there was identified
as "QEMU" so I'm not sure what's happening.

If anyone has some more information, please let me know. I'm confused
as to how to proceed, whether I implement my own VNC server (trivial,
really) or try to make this existing code work if possible?

Josh Guilfoyle

unread,
Dec 23, 2007, 2:31:49 AM12/23/07
to Android Developers
Found a little more information. When you connect to 5900 on the
emulator, the following line appears in the Android log:

D/RFBServer( 463): RFB Server Thread created

I searched for this string in the filesystem and found it is
implemented in /system/lib/libsurfaceflinger.so, which is exactly
where you'd expect a full RFB implementation. A quick run of strings
and grep over that object shows many relevant symbols implementing
what appears to be the main scope of the protocol. Interesting stuff,
I will try to design a proxy that will permit me to connect to the
server and find out more...

Josh Guilfoyle

unread,
Dec 23, 2007, 3:16:54 AM12/23/07
to Android Developers
I built a simple TCP proxy and was able to make it work.
Unfortunately, the VNC protocol implementation is extremely crude and
will only work if the VNC viewer natively requests a 16 bits-per-pixel
depth (possibly other restrictions as well, like endianness maybe?).
But it does work. Keyboard input seems to be fully supported, but I
am unable to use any other encoding than "raw", which is highly
inefficient. Specifying anything else causes the platform to implode
and automatically reboot.

Further study is needed, though...

Josh Guilfoyle

unread,
Dec 23, 2007, 3:55:33 AM12/23/07
to Android Developers
One note here. The protocol implementation is broken in the most
trivial way imaginable. The version handshaking requires that the
server send something like "RFB 003.003\n" (specifying protocol
version 3.3). Android's implementation, instead, sends "RFB
003.003\0". This causes dotnetvnc (the VNC viewer I am using on my
smartphone) to reject the server. Ugh!!

Josh Guilfoyle

unread,
Dec 28, 2007, 7:16:10 AM12/28/07
to Android Developers
Screw it. I wrote my own VNC server: http://android-vnc.googlecode.com.
Message has been deleted

Josh Guilfoyle

unread,
Jan 15, 2008, 12:54:54 PM1/15/08
to Android Developers
I just downloaded and built this:

http://www.life-gone-hazy.com/src/simple-tcp-proxy/simple-tcp-proxy.c

Then ran it on the host as ./simple-tcp-proxy <lan-ip> 5900 127.0.0.1
5900. From there, you can just connect the smartphone to any machine
in the network, and point the VNC viewer at <lan-ip>.

On Jan 15, 7:26 am, Randy <rhall...@yahoo.com> wrote:
> Josh:
>
> Great job. I setup android and fbvncserver on my laptop. I can run the
> VNC Viewer on my laptop using localhost and see the Android emulator.
> To run the VNC Viewer on my Moto Q do I need to use a tunneling
> solution to connect the VNC Viewer from the Moto Q using localhost? Is
> there a tunneling solution you would recommend?
>
> Thanks,
> Randy
>
> On Dec 28 2007, 7:16 am, Josh Guilfoyle <jast...@gmail.com> wrote:
>
> > Screw it. I wrote my own VNC server:http://android-vnc.googlecode.com.
>
> > On Dec 23, 12:55 am, Josh Guilfoyle <jast...@gmail.com> wrote:
>
> > > One note here. The protocol implementation is broken in the most
> > > trivial way imaginable. The version handshaking requires that the
> > > server send something like "RFB003.003\n" (specifying protocol
> > > version 3.3). Android's implementation, instead, sends "RFB
> > > 003.003\0". This causes dotnetvnc (the VNC viewer I am using on my
> > > smartphone) to reject the server. Ugh!!
>
> > > On Dec 23, 12:16 am, Josh Guilfoyle <jast...@gmail.com> wrote:
>
> > > > I built a simple TCP proxy and was able to make it work.
> > > > Unfortunately, the VNC protocol implementation is extremely crude and
> > > > will only work if the VNC viewer natively requests a 16 bits-per-pixel
> > > > depth (possibly other restrictions as well, like endianness maybe?).
> > > > But it does work. Keyboard input seems to be fully supported, but I
> > > > am unable to use any other encoding than "raw", which is highly
> > > > inefficient. Specifying anything else causes the platform to implode
> > > > and automatically reboot.
>
> > > > Further study is needed, though...
>
> > > > On Dec 22, 11:31 pm, Josh Guilfoyle <jast...@gmail.com> wrote:
>
> > > > > Found a little more information. When you connect to 5900 on the
> > > > > emulator, the following line appears in the Android log:
>
> > > > > D/RFBServer( 463):RFBServer Thread created
>
> > > > > I searched for this string in the filesystem and found it is
> > > > > implemented in /system/lib/libsurfaceflinger.so, which is exactly
> > > > > where you'd expect a fullRFBimplementation. A quick run of strings
> > > > > and grep over that object shows many relevant symbols implementing
> > > > > what appears to be the main scope of the protocol. Interesting stuff,
> > > > > I will try to design a proxy that will permit me to connect to the
> > > > > server and find out more...
>
> > > > > On Dec 22, 9:25 pm, Josh Guilfoyle <jast...@gmail.com> wrote:
>
> > > > > > I had a thought to create a VNC server for Android so that I could
> > > > > > connect my Windows Mobile smartphone to the Android emulator via the
> > > > > > sync cable and thus test the usability of some of my developing
> > > > > > programs without actually having installed the firmware anywhere. I
> > > > > > started tinkering with creating this server myself but quickly
> > > > > > discovered that port 5900 is already bound inside the emulator, with
> > > > > > apparently a functional protocol implemented that identifies the
> > > > > > desktop as "AndroidRFB".
Reply all
Reply to author
Forward
0 new messages