# HG changeset patch # User one # Date 1327316330 -32400 # Node ID b5c446990c0a65f2a9fc8cbbe7506d35982df131 # Parent bf3d7174660502db24a7e273fdccff3c2b1aea62 update diff -r bf3d71746605 -r b5c446990c0a conf.txt --- 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の書き方 行の先頭にユーザタグ()を付けて Ipアドレス Port番号 の順番で書きこんで下さい。 以下の形式が正しい書き方です。 - urasoe.ie.u-ryukyu.ac.jp 5900 + urasoe.ie.u-ryukyu.ac.jp 5999 diff -r bf3d71746605 -r b5c446990c0a src/treeVnc/AcceptClient.java --- 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; diff -r bf3d71746605 -r b5c446990c0a src/treeVnc/MyVncClient.java --- 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; } - } } diff -r bf3d71746605 -r b5c446990c0a src/treeVnc/TextBoxClient.java --- 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 temp = new ArrayList(); + private ArrayList temp = new ArrayList(); 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() } } }