comparison src/myVncClient/echoClient.java @ 35:b3c9be50ef89

add WaitReply
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Fri, 08 Jul 2011 20:20:43 +0900
parents 76f5994f2af2
children 0729e856169d
comparison
equal deleted inserted replaced
34:76f5994f2af2 35:b3c9be50ef89
4 import java.net.*; 4 import java.net.*;
5 5
6 6
7 public class echoClient { 7 public class echoClient {
8 public static Revalue value = new Revalue(); 8 public static Revalue value = new Revalue();
9 waitreply waitreply;// = new waitreply(); 9 WaitReply WaitReply;// = new WaitReply();
10 String responseLine,treenum,parent,line; 10 String responseLine,treenum,parent,line;
11 public static Socket echoSocket = null; 11 public static Socket echoSocket = null;
12 BufferedReader lostis = null; 12 BufferedReader lostis = null;
13 public static DataOutputStream os = null; 13 public static DataOutputStream os = null;
14 PrintStream lostos; 14 PrintStream lostos;
15 public static BufferedReader is = null; 15 public static BufferedReader is = null;
16 Socket clientSocket = null; 16 Socket clientSocket = null;
17 ServerSocket echoServer=null; 17 ServerSocket echoServer=null;
18 public static String name; 18 public static String name;
19 19
20 //waitreplyに自分自身を渡している 20 //WaitReplyに自分自身を渡している
21 public echoClient(){ 21 public echoClient(){
22 waitreply = new waitreply(this); 22 WaitReply = new WaitReply(this);
23 } 23 }
24 24
25 25
26 //VncViewerから引数をもらってきてproxy役を認識する 26 //VncViewerから引数をもらってきてproxy役を認識する
27 public echoClient(String _name){ 27 public echoClient(String _name){
77 } 77 }
78 */ 78 */
79 79
80 80
81 81
82 /**
83 * @param args select first connection or other
84 * @return
85 */
82 Revalue hostn(String args){ 86 Revalue hostn(String args){
83 // サーバーにメッセージを送る 87 // サーバーにメッセージを送る
84 if (echoSocket != null && os != null && is != null) { 88 if (echoSocket != null && os != null && is != null) {
85 try { 89 try {
86 //ip情報を取得する 90 //ip情報を取得する
114 } catch (IOException e) { 118 } catch (IOException e) {
115 System.err.println("IOException: " + e); 119 System.err.println("IOException: " + e);
116 120
117 } 121 }
118 122
119 waitreply = new waitreply(this); 123 WaitReply = new WaitReply(this);
120 System.out.println(waitreply); 124 System.out.println(WaitReply);
121 waitreply.start(); 125 WaitReply.start();
122 126
123 } 127 }
124 return value; 128 return value;
125 } 129 }
126 130
229 // } 233 // }
230 }catch (IOException e){ 234 }catch (IOException e){
231 System.out.println(e); 235 System.out.println(e);
232 } 236 }
233 try{ 237 try{
234 clientSocket.close();//waitreplyのacceptを終了させる 238 clientSocket.close();//WaitReplyのacceptを終了させる
235 } 239 }
236 catch (IOException e){ 240 catch (IOException e){
237 System.out.println(e); 241 System.out.println(e);
238 } 242 }
239 return value; 243 return value;