Mercurial > hg > Members > you > TreeVNC
changeset 24:b5c446990c0a
update
author | one |
---|---|
date | Mon, 23 Jan 2012 19:58:50 +0900 |
parents | bf3d71746605 |
children | 3fca497f5f5b |
files | conf.txt src/treeVnc/AcceptClient.java src/treeVnc/MyVncClient.java src/treeVnc/TextBoxClient.java |
diffstat | 4 files changed, 36 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/conf.txt Fri Jan 20 16:09:55 2012 +0900 +++ b/conf.txt Mon Jan 23 19:58:50 2012 +0900 @@ -1,4 +1,4 @@ -●conf.txtの書き方 +● conf.txtの書き方 行の先頭にユーザタグ(<user>)を付けて Ipアドレス Port番号 の順番で書きこんで下さい。 以下の形式が正しい書き方です。 -<user> urasoe.ie.u-ryukyu.ac.jp 5900 +<user> urasoe.ie.u-ryukyu.ac.jp 5999
--- a/src/treeVnc/AcceptClient.java Fri Jan 20 16:09:55 2012 +0900 +++ b/src/treeVnc/AcceptClient.java Mon Jan 23 19:58:50 2012 +0900 @@ -158,7 +158,7 @@ leaderflag = decisionLeader(Integer.parseInt(port),treebranch); } - private void replyLeaderNode(PrintStream os,BufferedReader is,String port) throws IOException, InterruptedException { + private synchronized void replyLeaderNode(PrintStream os,BufferedReader is,String port) throws IOException, InterruptedException { String checkRepetition = is.readLine(); os.println(ls.getLast()); replyNodeInformation(port); @@ -211,7 +211,7 @@ os.close(); } - private boolean replyCreateTree(PrintStream os,String port,String line) throws InterruptedException { + private synchronized boolean replyCreateTree(PrintStream os,String port,String line) throws InterruptedException { if (addrRegistor == true) { ls.add(myAddress); addrRegistor = false;
--- a/src/treeVnc/MyVncClient.java Fri Jan 20 16:09:55 2012 +0900 +++ b/src/treeVnc/MyVncClient.java Mon Jan 23 19:58:50 2012 +0900 @@ -49,28 +49,39 @@ System.out.println(mainArgs.length); inAnApplet = false; inSeparateFrame = true; - if(mainArgs.length == 0) { + +// if(mainArgs.length == 0) { bCast = new BroadCastClient("who"); bCast.createSocket(); bCast.sendData(); getBcast = new GetBroadCastClient(); + if(getNamePort() != null) + getBcast.text.checkBox(getNamePort()); runBcast = new Thread(getBcast); runBcast.start(); - } +// } + //getBcast.text.checkBox(getNamePort()); + /* try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } + */ + getBcast.setStopFlag(true); + pHost = getBcast.text.getAddress(); + port = Integer.parseInt(getBcast.text.getPort()); + getBcast.socketClose(); + +/* if(mainArgs.length == 0) getBcast.setStopFlag(true); else { getHost = new TextBoxClient(); getHost.ipRegister(); } - - + if (mainArgs.length > 0) pHost = getHost.getAddressOption(); //pHost = mainArgs[0]; @@ -88,6 +99,7 @@ getBcast.socketClose(); // port = 5999; } +*/ init(); start_threads(); start(); @@ -1240,6 +1252,17 @@ } } + private String getNamePort() { + ConfFileReader crf = new ConfFileReader(); + crf.fileRead(); + for(int i=0 ; i < crf.getName().size() ; i++) { + if(serverConfirm(crf.getName().get(i),crf.getPort().get(i))) + return crf.getName().get(i)+":"+crf.getPort().get(i); + } + return null; + } + + private boolean serverConfirm(String name,int port) { try{ new Socket(name,port); @@ -1248,7 +1271,6 @@ catch (IOException e){ return false; } - } }
--- a/src/treeVnc/TextBoxClient.java Fri Jan 20 16:09:55 2012 +0900 +++ b/src/treeVnc/TextBoxClient.java Mon Jan 23 19:58:50 2012 +0900 @@ -19,7 +19,7 @@ private double height = 500; private JLabel label; private boolean flag; - ArrayList<String> temp = new ArrayList<String>(); + private ArrayList<String> temp = new ArrayList<String>(); private int counter = 0; //private JCheckBox[] check = new JCheckBox[20]; private Checkbox[] check = new Checkbox[20]; @@ -149,7 +149,10 @@ for (int t = 0; t < counter; t++) { if (check[t].getState()) { System.out.println(check[t].getLabel()); - setStatus(check[t].getLabel()); + // if(int t =0) + setStatus(check[t].getLabel()); + //else + //setStatus() } } }