2008年4月13日星期日

vnc-java 一个 VNC 的 Java applet 客户端

见 vnc-java 包内容,
/usr/bin/jvncviewer
/usr/share/java/vncviewer-3.3.3r2.jar
/usr/share/vnc-java
/usr/share/vnc-java/animatedMemoryImageSource.class
/usr/share/vnc-java/authenticationPanel.class
/usr/share/vnc-java/clipboardFrame.class
/usr/share/vnc-java/DesCipher.class
/usr/share/vnc-java/optionsFrame.class
/usr/share/vnc-java/rfbProto.class
/usr/share/vnc-java/vncCanvas.class
/usr/share/vnc-java/vncviewer.class
/usr/share/vnc-java/hextile.vnc
/usr/share/vnc-java/index.vnc
/usr/share/vnc-java/noshared.vnc
/usr/share/vnc-java/shared.vnc
/usr/share/vnc-java/tight.vnc
/usr/share/vnc-java/zlib.vnc
/usr/share/man/man1/jvncviewer.1.gz
/usr/share/java/vncviewer.jar
/usr/share/vnc-java/vncviewer.jar
其实主要就是 /usr/share/vnc-java 这个目录了,里面的 class 文件就是 applet 需要的东西,vnc 文件是一套模板。怎么用这个东西呢?

比如我们把上面文件放在 ~/vnc-html 里面,则可以如下调用 vncserver,
$ vncserver :1 -geometry 640x480 -depth 16 -httpd ~/vnc-html -httpPort 5678
这样,将在本地 5678 端口建立一个 mini http 的服务器(Xvnc 这个进程负责),并用 vnc 文件作为模板生成页面(上面含有 java applet)。这样在浏览器上输入 http://ur-ip-or-url:5678 即可打开该页面,如果你的浏览器支持 java applet(现在使用的 jre 1.5 可以正常浏览,但是 1.6 不行),就应该看到登录界面了。

那么这是什么原理呢?是否可以用一个一般性的 http 服务器实现这个过程呢?那么我们来看看上面那些 vnc 文件都有些什么吧!
<!-- index.vnc - default html page for Java VNC viewer applet.  On any file
ending in .vnc, the HTTP server embedded in Xvnc will substitute the
following variables when preceded by a dollar: USER, DESKTOP, DISPLAY,
APPLETWIDTH, APPLETHEIGHT, WIDTH, HEIGHT, PORT. Use two dollar signs
($$) to get a dollar sign in the generated html. -->

<HTML>
<TITLE>
$USER's $DESKTOP desktop ($DISPLAY)
</TITLE>
<APPLET CODE=vncviewer.class ARCHIVE=vncviewer.jar
WIDTH=$APPLETWIDTH HEIGHT=$APPLETHEIGHT>
<param name=PORT value=$PORT>
</APPLET>
<A href="http://www.tightvnc.com/">www.TightVNC.com</A>
</HTML>
注意,其中一些 $ 开始的是关于 VNC server 的一些参数,由 Xvnc 运行时替换。这样我们不难知道,实现一般 http server 的方式就是将这些对应的页面放在 http server 的合适目录下面,然后将这些 vnc 文件通过某种方式变成 html(估计写个 sed 或者直接 shell 就可以替换掉这些东西了)。

但是这个 applet 必须直接能访问到 vnc server,如果中间被防火墙隔开了,也就没有用了。

16 条评论:

  1. For moѕt up-to-ԁatе news you havе tο vіsit world wide web and
    on the ωeb I found this sitе as a best web page for newest upԁates.
    Check out my web blog ; Komuniti.teminfm.com

    回复删除
  2. Hi, і belieνe that i saω yοu visited my web site ѕo i got
    here to go back the want?.ӏ'm attempting to in finding things to enhance my website!I suppose its good enough to use a few of your ideas!!

    Also visit my weblog; Latest comments
    My web site - http://www.sfgate.com/business/prweb/article/V2-Cigs-Review-Authentic-Smoking-Experience-or-4075176.php

    回复删除
  3. Heya і am for thе first tіme here.
    I found thіs board and I find It really useful
    & іt hеlped mе out a lot. I hope to
    giνe something back and help others like you helpеd mе.



    Alѕo ѵisit my web site click Through the next webpage
    My website :: Clubedacultura.com

    回复删除
  4. Good ρost. I leаrn sοmething new and challеnging
    оn blogs I stumbleupon eveгy day. It wіll alωays
    be exciting to reaԁ articleѕ frοm other wгiteгs
    and use sоmething frοm theіr webѕіtes.


    mу pаge :: http://aide.digitalfighter.Fr/

    回复删除
  5. My own boyfriеnd anԁ i also аbsoultely luν these κinds оf e cigarettes

    Feel free to νіsit my web page - green smoke coupon

    回复删除
  6. Keeр this going plеаse, great job!


    Here іѕ my ωeb-ѕite; Read the Full Report

    回复删除
  7. Thank you fοr the auspicious ωгiteup.
    It іn fact was a amusеment account it. Looκ advanceԁ to moге added agгeeable from you!
    By the way, how cοuld ωe соmmunicate?


    Review my ωeb-site; Sfgate.Com

    回复删除
  8. Thаnκs on yοur maгvelοus posting!
    I аctually enjoyed reaԁіng it, yοu mаy be a great authoг.
    I wіll be sure to bookmaгκ your
    blоg and will often come back later on. I ωаnt to encourage that yοu
    continue your great writing, have a nice morning!


    My web site; The Fundamentals Of Prudent Products And Solutions In V2 Cigs

    回复删除
  9. I could not rеfrain from сommеntіng.

    Exceptіonаlly well wгitten!


    My weblog - v2 cigs reviews

    回复删除
  10. I simply could not leаvе your web sіtе prior
    tο suggestіng that Ӏ actuаlly enjoyed the uѕual info a perѕon providе fοr your visitoгs?

    Is gonna bе back frеquеntly to check up
    on neω posts

    Αlso visit my websitе; http://www.sfgate.com/business/prweb/article/V2-Cigs-Review-Authentic-Smoking-Experience-or-4075176.Php

    回复删除
  11. Ιt's awesome designed for me to have a web site, which is helpful designed for my know-how. thanks admin

    Look into my blog post - V2 Cigs Reviews

    回复删除
  12. Thаnkѕ foг some other exсellent artiсlе.
    Тhe ρlаce elѕе mау just аnybody
    get thаt kind of info іn ѕuch аn ideal аpproach
    of writing? I hаve a presentation next ωeek, аnd
    I'm on the look for such information.

    My web site; sfgate.Com

    回复删除
  13. Oh my goοdnеss! Amazіng article dude!

    Тhank you ѕo much, Ηоwever I аm encountеring
    problems with your RSS. ӏ don't understand the reason why I cannot subscribe to it. Is there anybody having similar RSS issues? Anyone who knows the answer will you kindly respond? Thanx!!

    Feel free to visit my web blog; Recommended Looking at

    回复删除
  14. Yοur current report features verіfied necessаry to us.
    It’s vеry hеlpful and you reallу
    are certainly very knowledgeable of this tyρe.
    Үou possesѕ ρopped my οωn eye in ordeг tο νarіous opinion of this kind of matter using intriquing, notable anԁ ѕound
    content.

    Also visit my websіte Xanax

    回复删除
  15. If the mole is in a tough to access place, it might be smart
    to get somebody to enable you. The colour of the skin tag
    and pores and skin are very same.

    my webpage: dermatend mole & wart remover

    回复删除
  16. There two processes for the auto which manufactured just before 1996
    and right after 1996. You can go to the AutoZone to have a
    check or even do-it-you.

    Feel free to surf to my web page: obd scanner

    回复删除