Mercurial > hg > Applications > TreeVNC
view src/main/java/ac/ryukyu/treevnc/client/GetDataClient.java @ 2:dca3bd61b830
before change MyVncClient.java
author | Yu Taninari <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Jul 2012 18:47:33 +0900 |
parents | 75b54fd9e73a |
children |
line wrap: on
line source
package ac.ryukyu.treevnc.client; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; public class GetDataClient implements Runnable { private ServerSocket server = null; BufferedReader is; private int port = 8182; private boolean stopFlag = false; public TextBoxClient text = new TextBoxClient(); private void getData() { try { server = new ServerSocket(port); while(true) { Socket socket = server.accept(); is = new BufferedReader(new InputStreamReader( socket.getInputStream())); String line = is.readLine(); // text = new TextBoxClient(); if(line!=null){ text.checkBox(line); } // TextBoxClient text = new TextBoxClient(); text.setButton(); text.visible(); } } catch (IOException e) { e.printStackTrace(); } } public String textAddress() { return text.getAddress(); } public String textPort() { return text.getPort(); } void socketClose() { try { text.unVisible(); //server.close(); after the modify is.close(); } catch (IOException e) { e.printStackTrace(); } } /* private int castInt(byte[] a) { int value = 0; ByteArrayInputStream bais = new ByteArrayInputStream(a); DataInputStream dis = new DataInputStream(bais); try { value = dis.readInt(); } catch (IOException e) { } System.out.println(value); return value; } private String castString(byte[] a) { String recover = new String(a); recover = recover.replace("¥n", ""); recover = recover.trim(); System.out.println(recover); return recover; } */ public void run() { getData(); } public void setStopFlag(boolean stopFlag) { this.stopFlag = stopFlag; } public boolean isStopFlag() { return stopFlag; } }