转载时请注明出处和作者联系方式:http://blog.csdn.net/mimepp
作者联系方式:YU TAO <yut616 at sohu dot com>
关键字: microwindows, nanox, vncserver, libvncserver
nanox 在其 drivers 中集成 vncserver 的功能,,这里记录一下。
对应的代码在:
src/drivers/vncserver.c
它将 psd->addr 作为 rfbScreen->frameBuffer,并在画面有变化时,设置 MarkRect 表示对应的 Rect 需要被更新。
不过需要指出的是 libvncserver 是 GPL 的,对商业应用会有影响,需要注意。
运行抓图如下:
demo 例子:ntetris
从 PC 上通过 web 方式访问 vnc server:
弹出的认证对话框。
vnc 连接选项。
vnc 查看到的画面。
demo运行log:
src/bin$ ./ntetris Selected Visual: Visual class: TrueColor (4) id: 33 bits_per_rgb: 8 map_entries: 256 red_mask: 0x00ff0000 green_mask: 0x0000ff00 blue_mask: 0x000000ff createfont: (height == 0) found builtin font System (0) 15/04/2010 14:24:15 Listening for VNC connections on TCP port 5900 15/04/2010 14:24:15 Listening for HTTP connections on TCP port 5800 15/04/2010 14:24:15 URL http://yutao-desktop:5800 createfont: (height == 0) found builtin font System (0) 15/04/2010 14:24:39 other clients: 15/04/2010 14:24:39 Client Protocol Version 3.8 15/04/2010 14:24:39 Protocol version sent 3.8, using 3.8 15/04/2010 14:24:39 rfbProcessClientSecurityType: executing handler for type 2 15/04/2010 14:24:42 Pixel format for client 192.168.1.10: 15/04/2010 14:24:42 32 bpp, depth 24, little endian 15/04/2010 14:24:42 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 15/04/2010 14:24:42 Using compression level 1 for client 192.168.1.10 15/04/2010 14:24:42 Using image quality level 6 for client 192.168.1.10 15/04/2010 14:24:42 Enabling X-style cursor updates for client 192.168.1.10 15/04/2010 14:24:42 Enabling full-color cursor updates for client 192.168.1.10 15/04/2010 14:24:42 Enabling cursor position updates for client 192.168.1.10 15/04/2010 14:24:42 Enabling LastRect protocol extension for client 192.168.1.10 15/04/2010 14:24:42 Using raw encoding for client 192.168.1.10
vncviewer 连接的 log:
$ vncviewer 192.168.1.10 Connected to RFB server, using protocol version 3.8 Performing standard VNC authentication Password: Authentication successful Desktop name "nano-X" VNC server default format: 32 bits per pixel. Least significant byte first in each pixel. True colour: max red 65535 green 65535 blue 65535, shift red 0 green 255 blue 254 Using default colormap which is TrueColor. Pixel format: 32 bits per pixel. Least significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 Using shared memory PutImage Same machine: preferring raw encoding
vncviewer 画面: