WhyCan Forum

本站无需注册,无需积分,无需回复可下载所有资料,如果真的喜欢小站,请您注册之后请至少回复一个帖子激活Id,谢谢支持! 站长QQ: 516333132 (挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2018-02-15 12:07:21

落雁
会员
注册时间: 2017-09-06
累计积分: 62

ubuntu 编译运行 libvncserver

QQ20180215120553.jpg


  1. sudo apt-get install libtool

  2. sudo apt-get install vncviewer

  3. wget https://github.com/LibVNC/libvncserver/archive/LibVNCServer-0.9.11.tar.gz
    tar xvf LibVNCServer-0.9.11.tar.gz
    cd LibVNCServer-0.9.11
    ./autogen.sh
    ./configure
    make
    cd examples
    ./camera

  4. vncviewer localhost

最近编辑记录 落雁 (2018-02-15 12:07:54)

离线

#2 2018-02-15 12:38:14

落雁
会员
注册时间: 2017-09-06
累计积分: 62

Re: ubuntu 编译运行 libvncserver

短短几行代码就可以构建一个简单的 vnc 服务端程序:
https://libvnc.github.io/

#include <rfb/rfb.h>

int main(int argc,char** argv)
{
  rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
  server->frameBuffer=malloc(400*300*4);
  rfbInitServer(server);
  rfbRunEventLoop(server,-1,FALSE);
  return(0);
}

离线

#3 2018-02-15 14:02:20

落雁
会员
注册时间: 2017-09-06
累计积分: 62

Re: ubuntu 编译运行 libvncserver

test.c 说:

#include <rfb/rfb.h>

int main(int argc,char** argv)
{
  rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
  server->frameBuffer=malloc(400*300*4);
  rfbInitServer(server);
  rfbRunEventLoop(server,-1,FALSE);
  return(0);
}

如果你不想下载编译 libvncserver 的源码,那么直接执行下面的安装命令也可以:

sudo apt-get install libvncserver-dev

gcc -o test test.c  -lvncserver -lpthread -lgnutls -lgcrypt -lz -ljpeg -lresolv

短短几行代码实现一个vnc server.

最近编辑记录 落雁 (2018-02-15 15:51:50)

离线

#4 2018-02-15 18:56:23

落雁
会员
注册时间: 2017-09-06
累计积分: 62

Re: ubuntu 编译运行 libvncserver

simple.c

simple15.c

这两个是入门级demo

离线

#5 2019-08-24 11:38:44

firstman
会员
注册时间: 2019-04-06
累计积分: 153

Re: ubuntu 编译运行 libvncserver

QQ20190824113248.png


https://github.com/ponty/framebuffer-vncserver

我现在用这个 demo 在 ubuntu 跑起来 demo

但是不能输入:

firstman@ubuntu:/opt/framebuffer-vncserver/build$ sudo ./framebuffer-vncserver 
Initializing framebuffer device /dev/fb0...
  xres=800, yres=600, xresv=2048, yresv=1920, xoffs=0, yoffs=0, bpp=32
  offset:length red=16:8 green=8:8 blue=0:8 
No touch device
Initializing VNC server:
	width:  800
	height: 600
	bpp:    32
	port:   5900
Initializing server...
24/08/2019 11:08:40 Listening for VNC connections on TCP port 5900
24/08/2019 11:08:40 Listening for VNC connections on TCP6 port 5900
24/08/2019 11:16:22 Got connection from client 192.168.1.189
24/08/2019 11:16:22   other clients:
24/08/2019 11:16:22 Normal socket connection
24/08/2019 11:16:22 Client Protocol Version 3.3
24/08/2019 11:16:22 Protocol version sent 3.3, using 3.3
24/08/2019 11:16:23 Pixel format for client 192.168.1.189:
24/08/2019 11:16:23   32 bpp, depth 32, little endian
24/08/2019 11:16:23   true colour: max r 31 g 31 b 31, shift r 0 g 5 b 10
24/08/2019 11:16:23 no translation needed
24/08/2019 11:16:23 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0x00000003)
24/08/2019 11:16:23 Using hextile encoding for client 192.168.1.189

请问楼主, No touch device 如何解决?

代码在这里: https://github.com/ponty/framebuffer-vncserver/blob/master/src/framebuffer-vncserver.c

最近编辑记录 firstman (2019-08-24 11:41:09)

离线

页脚