Mercurial > hg > Members > nobuyasu > tightVNCProxy
view src/test/VncServerTest.java @ 191:b2f0cd0cff6c default tip
Added tag Version-1.0 for changeset 79046b4e5990
author | Yu Taninari <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Nov 2011 15:52:44 +0900 |
parents | 8a0e30e527e7 |
children |
line wrap: on
line source
package test; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; public class VncServerTest implements java.lang.Runnable { String host; int acceptPort; Rfb rfb; Thread th; ServerSocket sock; public static void main(String[] argv) { VncServerTest s = new VncServerTest(argv); try { s.init(); }catch (IOException e) { e.printStackTrace(); } s.startThread(); } VncServerTest(String[] argv) { acceptPort = Integer.parseInt(argv[0]); rfb = new Rfb(); } void init() throws IOException { sock = new ServerSocket(acceptPort); th = new Thread(this); } void startThread() { th.start(); } public void run() { try { System.out.println("accept Port number : "+ acceptPort); Socket cli = sock.accept(); InputStream is = cli.getInputStream(); OutputStream os = cli.getOutputStream(); rfb.sendRfbVersion(os); int rfbMinor = rfb.readVersionMsg(is, os); rfb.sendSecurityType(os); rfb.readSecType(is); rfb.sendSecResult(os, is); }catch(IOException e) { e.printStackTrace(); } } }