annotate src/myVncClient/CuiMyVncClient.java @ 69:1f05b73b15df

modify MyVncClient.java and CuiMyVNcClient.java
author e085711
date Sun, 07 Aug 2011 04:22:07 +0900
parents 5e7110277cf0
children affdcbdc90ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
1 package myVncClient;
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
2
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
3 import java.awt.*;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
4 import java.awt.event.*;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
5 import java.io.*;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
6 import java.net.*;
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
7 import java.util.Random;
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
8
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
9 import myVncClient.AcceptThread;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
10 import myVncClient.OptionsNoFrame;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
11
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
12 public class CuiMyVncClient implements InterfaceForViewer {
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
13
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
14 public static void main(String[] argv) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
15 CuiMyVncClient v = new CuiMyVncClient();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
16 v.runClient(argv, v);
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
17
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
18 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
19
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
20 private void runClient(String[] argv, CuiMyVncClient v) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
21 mainArgs = argv;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
22
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
23 v.init(null);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
24 v.start_threads();
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
25
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
26 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
27
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
28 String[] mainArgs;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
29 String username;
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
30
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
31 // RfbProto rfb;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
32 MyRfbProto rfb;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
33 Thread rfbThread;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
34 Thread accThread;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
35 Thread clientThread;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
36
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
37 Frame vncFrame;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
38 Container vncContainer;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
39 ScrollPane desktopScrollPane;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
40 GridBagLayout gridbag;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
41 ButtonPanel buttonPanel;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
42 Label connStatusLabel;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
43 CuiVncCanvas vc;
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
44 // OptionsFrame options;
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
45 OptionsNoFrame options;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
46 ClipboardFrame clipboard;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
47 RecordingFrame rec;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
48
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
49 // Control session recording.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
50 Object recordingSync;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
51 String sessionFileName;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
52 boolean recordingActive;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
53 boolean recordingStatusChanged;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
54 String cursorUpdatesDef;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
55 String eightBitColorsDef;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
56
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
57 // Variables read from parameter values.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
58 String socketFactory;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
59 String host;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
60 int port;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
61 String passwordParam;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
62 boolean showControls;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
63 boolean offerRelogin;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
64 boolean showOfflineDesktop;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
65 int deferScreenUpdates;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
66 int deferCursorUpdates;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
67 int deferUpdateRequests;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
68 int debugStatsExcludeUpdates;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
69 int debugStatsMeasureUpdates;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
70
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
71 private static final long serialVersionUID = 1L;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
72 boolean inAnApplet = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
73 boolean inSeparateFrame = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
74 Socket clientSocket = null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
75 String parent, treenum;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
76 private String leaderflag;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
77 boolean runflag = false;
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
78 boolean first = true;
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
79
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
80 EchoClient echo;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
81
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
82 void checkArgs(String[] argv) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
83 if (argv.length > 3) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
84 username = argv[3];
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
85 } else if (argv.length < 2) {
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
86 System.out.println("Please enter argv");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
87 System.out.println("hostname(IPaddress) port password");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
88 System.exit(0);
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
89 } else {
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
90 username = argv[0];
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
91 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
92 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
93
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
94 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
95 // init()
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
96 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
97
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
98 public void init(EchoClient value) {
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
99 Random rnd = new Random();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
100 long ran = rnd.nextInt(5000);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
101 try {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
102 Thread.sleep(ran);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
103 } catch (InterruptedException e1) {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
104 e1.printStackTrace();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
105 }
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
106 // readParameters();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
107
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
108 readParameters(value);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
109
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
110 options = new OptionsNoFrame(this);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
111 recordingSync = new Object();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
112
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
113 sessionFileName = null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
114 recordingActive = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
115 recordingStatusChanged = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
116 cursorUpdatesDef = null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
117 eightBitColorsDef = null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
118
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
119 /*
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
120 * try { connectAndAuthenticate(); } catch (NoRouteToHostException e) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
121 * fatalError("Network error: no route to server: " + host, e); } catch
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
122 * (UnknownHostException e) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
123 * fatalError("Network error: server name unknown: " + host, e); } catch
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
124 * (ConnectException e) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
125 * fatalError("Network error: could not connect to server: " + host +
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
126 * ":" + port, e); } catch (Exception e) { }
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
127 */
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
128 rfbThread = new Thread(this);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
129
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
130 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
131
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
132 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
133 // run() - executed by the rfbThread to deal with the RFB socket.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
134 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
135
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
136 public void start_threads() {
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
137 rfbThread.start();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
138 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
139
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
140 public void run() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
141
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
142 try {
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
143 if (first) {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
144 connectAndAuthenticate();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
145 first = false;
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
146 }else {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
147 reConnectAndAuthenticate();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
148 }
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
149 accThread = new Thread(new AcceptThread(rfb, 5999));
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
150 accThread.start();
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
151 doProtocolInitialisation();
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
152
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
153 vc = new CuiVncCanvas(this, 0, 0);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
154 vc.updateFramebufferSize();
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
155
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
156 } catch (IOException e) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
157 System.out.println("Socket error");
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
158 // parent no find
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
159 Random rnd = new Random();
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
160 long ran = rnd.nextInt(5000) + 5000;
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
161 System.out.println(ran);
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
162 // 親がいない場合の処理はここに書く!!!!
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
163 /**
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
164 * this while reconnection
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
165 */
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
166
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
167 int counter = 0;
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
168
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
169 /*
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
170 vncFrame.setVisible(false);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
171 vncFrame.dispose();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
172 */
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
173 while (true) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
174 /**
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
175 * if my last node case reconnectoion stop
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
176 */
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
177
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
178 echo = new EchoClient(echo, this);
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
179 try {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
180 Thread.sleep(ran);
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
181 } catch (InterruptedException e1) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
182 e1.printStackTrace();
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
183 }
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
184
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
185 if (counter >= 3) {
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
186 echo.openport();
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
187 echo.notfoundParent();
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
188 }
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
189
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
190 echo.openport();
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
191 // runflag = echo.losthost();
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
192 if (echo.losthost()) {
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
193 return;
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
194 }
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
195 counter++;
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
196 }
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
197
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
198 // System.exit(0);
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
199 }catch (Exception e) {
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
200 System.out.println(e);
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
201 System.exit(0);
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
202 }
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
203 try{
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
204
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
205 processNormalProtocol();// main loop
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
206
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
207 } catch (NoRouteToHostException e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
208 fatalError("Network error: no route to server: " + host, e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
209 } catch (UnknownHostException e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
210 fatalError("Network error: server name unknown: " + host, e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
211 } catch (ConnectException e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
212 fatalError("Network error: could not connect to server: " + host
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
213 + ":" + port, e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
214 } catch (EOFException e) {
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
215
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
216 if (leaderflag != null) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
217 while (true) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
218 echo = new EchoClient(echo, this);
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
219 echo.openport();
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
220 // runflag = echo.losthost();
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
221 if (echo.losthost()) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
222 break;
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
223 }
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
224 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
225 } else {
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
226 if (showOfflineDesktop) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
227 e.printStackTrace();
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
228 System.out
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
229 .println("Network error: remote side closed connection");
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
230 if (vc != null) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
231 vc.enableInput(false);
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
232 }
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
233 if (rfb != null && !rfb.closed())
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
234 rfb.close();
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
235 if (showControls && buttonPanel != null) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
236 buttonPanel.disableButtonsOnDisconnect();
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
237 }
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
238 } else {
67
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
239 fatalError("Network error: remote side closed connection",
5e7110277cf0 modify CuiMyVncClient
e085711
parents: 65
diff changeset
240 e);
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
241 }
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
242 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
243 } catch (IOException e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
244 String str = e.getMessage();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
245 if (str != null && str.length() != 0) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
246 fatalError("Network Error: " + str, e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
247 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
248 fatalError(e.toString(), e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
249 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
250 } catch (Exception e) {
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
251 String str = e.getMessage();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
252 if (str != null && str.length() != 0) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
253 fatalError("Error: " + str, e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
254 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
255 fatalError(e.toString(), e);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
256 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
257 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
258
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
259 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
260
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
261 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
262 // Process RFB socket messages.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
263 // If the rfbThread is being stopped, ignore any exceptions,
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
264 // otherwise rethrow the exception so it can be handled.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
265 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
266
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
267 void processNormalProtocol() throws Exception {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
268 try {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
269 vc.processNormalProtocol();// main loop
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
270 } catch (Exception e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
271 if (rfbThread == null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
272 System.out.println("Ignoring RFB socket exceptions"
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
273 + " because applet is stopping");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
274 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
275 throw e;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
276 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
277 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
278 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
279
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
280 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
281 // Connect to the RFB server and authenticate the user.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
282 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
283
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
284 void connectAndAuthenticate() throws Exception {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
285 showConnectionStatus("Initializing...");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
286
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
287 showConnectionStatus("Connecting to " + host + ", port " + port + "...");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
288
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
289 // rfb = new RfbProto(host, port, this);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
290 rfb = new MyRfbProto(host, port);
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
291
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
292 showConnectionStatus("Connected to server");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
293
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
294 rfb.readVersionMsg();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
295 showConnectionStatus("RFB server supports protocol version "
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
296 + rfb.serverMajor + "." + rfb.serverMinor);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
297
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
298 rfb.writeVersionMsg();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
299 showConnectionStatus("Using RFB protocol version " + rfb.clientMajor
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
300 + "." + rfb.clientMinor);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
301
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
302 int secType = rfb.negotiateSecurity();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
303 int authType;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
304 if (secType == RfbProto.SecTypeTight) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
305 showConnectionStatus("Enabling TightVNC protocol extensions");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
306 rfb.setupTunneling();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
307 authType = rfb.negotiateAuthenticationTight();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
308 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
309 authType = secType;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
310 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
311
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
312 switch (authType) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
313 case RfbProto.AuthNone:
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
314 showConnectionStatus("No authentication needed");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
315 rfb.authenticateNone();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
316 break;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
317 case RfbProto.AuthVNC:
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
318 showConnectionStatus("Performing standard VNC authentication");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
319 if (passwordParam != null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
320 rfb.authenticateVNC(passwordParam);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
321 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
322 String pw = askPassword();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
323 rfb.authenticateVNC(pw);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
324 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
325 break;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
326 default:
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
327 throw new Exception("Unknown authentication scheme " + authType);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
328 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
329 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
330
69
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
331
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
332
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
333 void reConnectAndAuthenticate() throws Exception {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
334 showConnectionStatus("Initializing...");
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
335
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
336 showConnectionStatus("Connecting to " + host + ", port " + port + "...");
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
337
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
338 rfb.changeParent(host, port);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
339
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
340 showConnectionStatus("Connected to server");
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
341
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
342 rfb.readVersionMsg();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
343 showConnectionStatus("RFB server supports protocol version "
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
344 + rfb.serverMajor + "." + rfb.serverMinor);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
345
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
346 rfb.writeVersionMsg();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
347 showConnectionStatus("Using RFB protocol version " + rfb.clientMajor
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
348 + "." + rfb.clientMinor);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
349
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
350 int secType = rfb.negotiateSecurity();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
351 int authType;
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
352 if (secType == RfbProto.SecTypeTight) {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
353 showConnectionStatus("Enabling TightVNC protocol extensions");
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
354 rfb.setupTunneling();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
355 authType = rfb.negotiateAuthenticationTight();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
356 } else {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
357 authType = secType;
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
358 }
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
359
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
360 switch (authType) {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
361 case RfbProto.AuthNone:
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
362 showConnectionStatus("No authentication needed");
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
363 rfb.authenticateNone();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
364 break;
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
365 case RfbProto.AuthVNC:
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
366 showConnectionStatus("Performing standard VNC authentication");
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
367 if (passwordParam != null) {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
368 rfb.authenticateVNC(passwordParam);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
369 } else {
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
370 String pw = askPassword();
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
371 rfb.authenticateVNC(pw);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
372 }
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
373 break;
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
374 default:
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
375 throw new Exception("Unknown authentication scheme " + authType);
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
376 }
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
377 }
1f05b73b15df modify MyVncClient.java and CuiMyVNcClient.java
e085711
parents: 67
diff changeset
378
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
379 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
380 // Show a message describing the connection status.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
381 // To hide the connection status label, use (msg == null).
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
382 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
383
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
384 void showConnectionStatus(String msg) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
385 System.out.println(msg);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
386 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
387
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
388 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
389 // Show an authentication panel.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
390 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
391
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
392 String askPassword() throws Exception {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
393 /*
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
394 * showConnectionStatus(null); AuthPanel authPanel = new
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
395 * AuthPanel(this);
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
396 *
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
397 * GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth =
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
398 * GridBagConstraints.REMAINDER; gbc.anchor =
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
399 * GridBagConstraints.NORTHWEST; gbc.weightx = 1.0; gbc.weighty = 1.0;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
400 * gbc.ipadx = 100; gbc.ipady = 50; gridbag.setConstraints(authPanel,
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
401 * gbc); vncContainer.add(authPanel);
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
402 *
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
403 *
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
404 * authPanel.moveFocusToDefaultField(); vncContainer.remove(authPanel);
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
405 */
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
406 showConnectionStatus("ask password...");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
407 String pw = mainArgs[2];
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
408 return pw;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
409 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
410
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
411 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
412 // Do the rest of the protocol initialisation.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
413 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
414
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
415 void doProtocolInitialisation() throws IOException {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
416 rfb.writeClientInit();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
417 rfb.readServerInit();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
418
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
419 System.out.println("Desktop name is " + rfb.desktopName);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
420 System.out.println("Desktop size is " + rfb.framebufferWidth + " x "
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
421 + rfb.framebufferHeight);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
422
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
423 setEncodings();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
424
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
425 // showConnectionStatus(null);
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
426 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
427
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
428 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
429 // Send current encoding list to the RFB server.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
430 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
431
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
432 int[] encodingsSaved;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
433 int nEncodingsSaved;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
434
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
435 void setEncodings() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
436 setEncodings(false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
437 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
438
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
439 void autoSelectEncodings() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
440 setEncodings(true);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
441 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
442
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
443 void setEncodings(boolean autoSelectOnly) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
444 if (options == null || rfb == null || !rfb.inNormalProtocol)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
445 return;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
446
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
447 int preferredEncoding = options.preferredEncoding;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
448 if (preferredEncoding == -1) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
449 long kbitsPerSecond = rfb.kbitsPerSecond();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
450 if (nEncodingsSaved < 1) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
451 // Choose Tight or ZRLE encoding for the very first update.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
452 System.out.println("Using Tight/ZRLE encodings");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
453 preferredEncoding = RfbProto.EncodingTight;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
454 } else if (kbitsPerSecond > 2000
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
455 && encodingsSaved[0] != RfbProto.EncodingHextile) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
456 // Switch to Hextile if the connection speed is above 2Mbps.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
457 System.out.println("Throughput " + kbitsPerSecond
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
458 + " kbit/s - changing to Hextile encoding");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
459 preferredEncoding = RfbProto.EncodingHextile;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
460 } else if (kbitsPerSecond < 1000
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
461 && encodingsSaved[0] != RfbProto.EncodingTight) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
462 // Switch to Tight/ZRLE if the connection speed is below 1Mbps.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
463 System.out.println("Throughput " + kbitsPerSecond
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
464 + " kbit/s - changing to Tight/ZRLE encodings");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
465 preferredEncoding = RfbProto.EncodingTight;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
466 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
467 // Don't change the encoder.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
468 if (autoSelectOnly)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
469 return;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
470 preferredEncoding = encodingsSaved[0];
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
471 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
472 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
473 // Auto encoder selection is not enabled.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
474 if (autoSelectOnly)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
475 return;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
476 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
477
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
478 int[] encodings = new int[20];
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
479 int nEncodings = 0;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
480
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
481 encodings[nEncodings++] = preferredEncoding;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
482 if (options.useCopyRect) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
483 encodings[nEncodings++] = RfbProto.EncodingCopyRect;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
484 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
485 if (preferredEncoding != RfbProto.EncodingTight) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
486 encodings[nEncodings++] = RfbProto.EncodingTight;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
487 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
488 if (preferredEncoding != RfbProto.EncodingZRLE) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
489 encodings[nEncodings++] = RfbProto.EncodingZRLE;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
490 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
491 if (preferredEncoding != RfbProto.EncodingHextile) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
492 encodings[nEncodings++] = RfbProto.EncodingHextile;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
493 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
494 if (preferredEncoding != RfbProto.EncodingZlib) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
495 encodings[nEncodings++] = RfbProto.EncodingZlib;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
496 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
497 /*
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
498 * if (preferredEncoding != RfbProto.EncodingCoRRE) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
499 * encodings[nEncodings++] = RfbProto.EncodingCoRRE; } if
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
500 * (preferredEncoding != RfbProto.EncodingRRE) { encodings[nEncodings++]
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
501 * = RfbProto.EncodingRRE; }
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
502 *
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
503 * if (options.compressLevel >= 0 && options.compressLevel <= 9) {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
504 * encodings[nEncodings++] = RfbProto.EncodingCompressLevel0 +
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
505 * options.compressLevel; } if (options.jpegQuality >= 0 &&
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
506 * options.jpegQuality <= 9) { encodings[nEncodings++] =
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
507 * RfbProto.EncodingQualityLevel0 + options.jpegQuality; } if
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
508 * (options.requestCursorUpdates) { encodings[nEncodings++] =
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
509 * RfbProto.EncodingXCursor; encodings[nEncodings++] =
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
510 * RfbProto.EncodingRichCursor; if (!options.ignoreCursorUpdates)
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
511 * encodings[nEncodings++] = RfbProto.EncodingPointerPos; }
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
512 */
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
513
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
514 encodings[nEncodings++] = RfbProto.EncodingLastRect;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
515 encodings[nEncodings++] = RfbProto.EncodingNewFBSize;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
516
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
517 boolean encodingsWereChanged = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
518 if (nEncodings != nEncodingsSaved) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
519 encodingsWereChanged = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
520 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
521 for (int i = 0; i < nEncodings; i++) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
522 if (encodings[i] != encodingsSaved[i]) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
523 encodingsWereChanged = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
524 break;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
525 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
526 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
527 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
528
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
529 if (encodingsWereChanged) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
530 try {
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
531 // rfb.writeSetEncodings(encodings, nEncodings);
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
532 if (vc != null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
533 vc.softCursorFree();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
534 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
535 } catch (Exception e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
536 e.printStackTrace();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
537 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
538 encodingsSaved = encodings;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
539 nEncodingsSaved = nEncodings;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
540 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
541 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
542
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
543 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
544 // setCutText() - send the given cut text to the RFB server.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
545 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
546
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
547 void setCutText(String text) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
548 try {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
549 if (rfb != null && rfb.inNormalProtocol) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
550 rfb.writeClientCutText(text);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
551 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
552 } catch (Exception e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
553 e.printStackTrace();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
554 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
555 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
556
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
557 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
558 // Order change in session recording status. To stop recording, pass
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
559 // null in place of the fname argument.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
560 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
561
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
562 void setRecordingStatus(String fname) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
563 synchronized (recordingSync) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
564 sessionFileName = fname;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
565 recordingStatusChanged = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
566 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
567 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
568
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
569 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
570 // Start or stop session recording. Returns true if this method call
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
571 // causes recording of a new session.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
572 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
573
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
574 boolean checkRecordingStatus() throws IOException {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
575 synchronized (recordingSync) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
576 if (recordingStatusChanged) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
577 recordingStatusChanged = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
578 if (sessionFileName != null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
579 startRecording();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
580 return true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
581 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
582 stopRecording();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
583 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
584 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
585 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
586 return false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
587 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
588
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
589 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
590 // Start session recording.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
591 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
592
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
593 protected void startRecording() throws IOException {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
594 synchronized (recordingSync) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
595 if (!recordingActive) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
596 // Save settings to restore them after recording the session.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
597 cursorUpdatesDef = options.choices[options.cursorUpdatesIndex]
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
598 .getSelectedItem();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
599 eightBitColorsDef = options.choices[options.eightBitColorsIndex]
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
600 .getSelectedItem();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
601 // Set options to values suitable for recording.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
602 options.choices[options.cursorUpdatesIndex].select("Disable");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
603 options.choices[options.cursorUpdatesIndex].setEnabled(false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
604 options.setEncodings();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
605 options.choices[options.eightBitColorsIndex].select("No");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
606 options.choices[options.eightBitColorsIndex].setEnabled(false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
607 options.setColorFormat();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
608 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
609 rfb.closeSession();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
610 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
611
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
612 System.out.println("Recording the session in " + sessionFileName);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
613 rfb.startSession(sessionFileName);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
614 recordingActive = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
615 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
616 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
617
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
618 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
619 // Stop session recording.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
620 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
621
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
622 protected void stopRecording() throws IOException {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
623 synchronized (recordingSync) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
624 if (recordingActive) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
625 // Restore options.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
626 options.choices[options.cursorUpdatesIndex]
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
627 .select(cursorUpdatesDef);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
628 options.choices[options.cursorUpdatesIndex].setEnabled(true);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
629 options.setEncodings();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
630 options.choices[options.eightBitColorsIndex]
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
631 .select(eightBitColorsDef);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
632 options.choices[options.eightBitColorsIndex].setEnabled(true);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
633 options.setColorFormat();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
634
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
635 rfb.closeSession();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
636 System.out.println("Session recording stopped.");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
637 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
638 sessionFileName = null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
639 recordingActive = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
640 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
641 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
642
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
643 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
644 // readParameters() - read parameters from the html source or from the
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
645 // command line. On the command line, the arguments are just a sequence of
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
646 // param_name/param_value pairs where the names and values correspond to
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
647 // those expected in the html applet tag source.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
648 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
649
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
650 void readParameters(EchoClient value) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
651 /*
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
652 * host = readParameter("HOST", !inAnApplet);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
653 *
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
654 * if (host == null) { host = getCodeBase().getHost(); if
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
655 * (host.equals("")) { fatalError("HOST parameter not specified"); } }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
656 *
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
657 * port = readIntParameter("PORT", 5550);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
658 */
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
659 if (value == null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
660
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
661 if (clientSocket == null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
662 String pHost;
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
663 if (mainArgs.length > 0)
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
664 pHost = mainArgs[0];
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
665 else
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
666 pHost = "cls080.ie.u-ryukyu.ac.jp";
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
667 echo = new EchoClient(pHost, this);
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
668 echo.openport();
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
669
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
670 value = echo.hostn("1");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
671 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
672 echo = new EchoClient();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
673 value = echo.Interruption(clientSocket);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
674 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
675 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
676 // proxyからの返信で接続先を決定する
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
677 host = value.responseLine;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
678 parent = value.parent;
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
679 if (value.treenum != null) {
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
680 treenum = value.treenum;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
681 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
682 treenum = echo.treenum;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
683 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
684 if (value.leaderflag != null) {
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
685 leaderflag = value.leaderflag;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
686 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
687 leaderflag = echo.leaderflag;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
688 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
689 System.out.println("Parent =" + parent);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
690 System.out.println("mynumber =" + treenum);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
691 System.out.println("connect host =" + host);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
692 System.out.println("leaderflag(boolean) = " + leaderflag);
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
693
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
694 echo = value;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
695
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
696 /*
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
697 * if (host == null) { host = getCodeBase().getHost(); if
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
698 * (host.equals("")) { fatalError("HOST parameter not specified"); } }
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
699 */
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
700 port = 5999;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
701 // Read "ENCPASSWORD" or "PASSWORD" parameter if specified.
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
702 // readPasswordParameters();
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
703
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
704 String str;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
705 if (inAnApplet) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
706 str = readParameter("Open New Window", false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
707 if (str != null && str.equalsIgnoreCase("Yes"))
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
708 inSeparateFrame = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
709 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
710
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
711 // "Show Controls" set to "No" disables button panel.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
712 showControls = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
713 str = readParameter("Show Controls", false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
714 if (str != null && str.equalsIgnoreCase("No"))
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
715 showControls = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
716
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
717 // "Offer Relogin" set to "No" disables "Login again" and "Close
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
718 // window" buttons under error messages in applet mode.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
719 offerRelogin = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
720 str = readParameter("Offer Relogin", false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
721 if (str != null && str.equalsIgnoreCase("No"))
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
722 offerRelogin = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
723
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
724 // Do we continue showing desktop on remote disconnect?
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
725 showOfflineDesktop = false;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
726 str = readParameter("Show Offline Desktop", false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
727 if (str != null && str.equalsIgnoreCase("Yes"))
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
728 showOfflineDesktop = true;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
729
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
730 // Fine tuning options.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
731 deferScreenUpdates = readIntParameter("Defer screen updates", 20);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
732 deferCursorUpdates = readIntParameter("Defer cursor updates", 10);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
733 deferUpdateRequests = readIntParameter("Defer update requests", 0);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
734
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
735 // Debugging options.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
736 debugStatsExcludeUpdates = readIntParameter("DEBUG_XU", 0);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
737 debugStatsMeasureUpdates = readIntParameter("DEBUG_CU", 0);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
738
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
739 // SocketFactory.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
740 socketFactory = readParameter("SocketFactory", false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
741 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
742
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
743 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
744 // Read password parameters. If an "ENCPASSWORD" parameter is set,
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
745 // then decrypt the password into the passwordParam string. Otherwise,
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
746 // try to read the "PASSWORD" parameter directly to passwordParam.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
747 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
748
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
749 private void readPasswordParameters() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
750 String encPasswordParam = readParameter("ENCPASSWORD", false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
751
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
752 if (encPasswordParam == null) {
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
753 passwordParam = readParameter("PASSWORD", false);
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
754 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
755 // ENCPASSWORD is hexascii-encoded. Decode.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
756 byte[] pw = { 0, 0, 0, 0, 0, 0, 0, 0 };
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
757 int len = encPasswordParam.length() / 2;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
758 if (len > 8)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
759 len = 8;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
760 for (int i = 0; i < len; i++) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
761 String hex = encPasswordParam.substring(i * 2, i * 2 + 2);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
762 Integer x = new Integer(Integer.parseInt(hex, 16));
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
763 pw[i] = x.byteValue();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
764 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
765 // Decrypt the password.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
766 byte[] key = { 23, 82, 107, 6, 35, 78, 88, 7 };
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
767 DesCipher des = new DesCipher(key);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
768 des.decrypt(pw, 0, pw, 0);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
769 passwordParam = new String(pw);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
770
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
771 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
772 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
773
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
774 public String readParameter(String name, boolean required) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
775 for (int i = 0; i < mainArgs.length; i += 2) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
776 if (mainArgs[i].equalsIgnoreCase(name)) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
777 try {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
778 return mainArgs[i + 1];
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
779 } catch (Exception e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
780 if (required) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
781 fatalError(name + " parameter not specified");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
782 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
783 return null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
784 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
785 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
786 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
787 if (required) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
788 fatalError(name + " parameter not specified");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
789 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
790 return null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
791 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
792
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
793 int readIntParameter(String name, int defaultValue) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
794 String str = readParameter(name, false);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
795 int result = defaultValue;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
796 if (str != null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
797 try {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
798 result = Integer.parseInt(str);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
799 } catch (NumberFormatException e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
800 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
801 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
802 return result;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
803 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
804
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
805 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
806 // disconnect() - close connection to server.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
807 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
808
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
809 synchronized public void disconnect() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
810 System.out.println("Disconnecting");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
811
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
812 if (vc != null) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
813 double sec = (System.currentTimeMillis() - vc.statStartTime) / 1000.0;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
814 double rate = Math.round(vc.statNumUpdates / sec * 100) / 100.0;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
815 int nRealRects = vc.statNumPixelRects;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
816 int nPseudoRects = vc.statNumTotalRects - vc.statNumPixelRects;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
817 System.out.println("Updates received: " + vc.statNumUpdates + " ("
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
818 + nRealRects + " rectangles + " + nPseudoRects
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
819 + " pseudo), " + rate + " updates/sec");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
820 int numRectsOther = nRealRects - vc.statNumRectsTight
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
821 - vc.statNumRectsZRLE - vc.statNumRectsHextile
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
822 - vc.statNumRectsRaw - vc.statNumRectsCopy;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
823 System.out.println("Rectangles:" + " Tight=" + vc.statNumRectsTight
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
824 + "(JPEG=" + vc.statNumRectsTightJPEG + ") ZRLE="
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
825 + vc.statNumRectsZRLE + " Hextile="
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
826 + vc.statNumRectsHextile + " Raw=" + vc.statNumRectsRaw
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
827 + " CopyRect=" + vc.statNumRectsCopy + " other="
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
828 + numRectsOther);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
829
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
830 int raw = vc.statNumBytesDecoded;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
831 int compressed = vc.statNumBytesEncoded;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
832 if (compressed > 0) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
833 double ratio = Math.round((double) raw / compressed * 1000) / 1000.0;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
834 System.out.println("Pixel data: " + vc.statNumBytesDecoded
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
835 + " bytes, " + vc.statNumBytesEncoded
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
836 + " compressed, ratio " + ratio);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
837 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
838 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
839
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
840 if (rfb != null && !rfb.closed())
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
841 rfb.close();
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
842 // options.dispose();
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
843 clipboard.dispose();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
844 if (rec != null)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
845 rec.dispose();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
846
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
847 System.exit(0);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
848
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
849 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
850
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
851 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
852 // fatalError() - print out a fatal error message.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
853 // FIXME: Do we really need two versions of the fatalError() method?
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
854 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
855
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
856 synchronized public void fatalError(String str) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
857 System.out.println(str);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
858 System.exit(1);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
859 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
860
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
861 synchronized public void fatalError(String str, Exception e) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
862
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
863 if (rfb != null && rfb.closed()) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
864 // Not necessary to show error message if the error was caused
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
865 // by I/O problems after the rfb.close() method call.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
866 System.out.println("RFB thread finished");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
867 return;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
868 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
869
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
870 System.out.println(str);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
871 e.printStackTrace();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
872
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
873 if (rfb != null)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
874 rfb.close();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
875
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
876 System.exit(1);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
877
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
878 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
879
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
880 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
881 // Show message text and optionally "Relogin" and "Close" buttons.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
882 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
883
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
884 void showMessage(String msg) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
885 vncContainer.removeAll();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
886
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
887 Label errLabel = new Label(msg, Label.CENTER);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
888 errLabel.setFont(new Font("Helvetica", Font.PLAIN, 12));
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
889
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
890 if (offerRelogin) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
891 /*
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
892 * Panel gridPanel = new Panel(new GridLayout(0, 1)); Panel
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
893 * outerPanel = new Panel(new FlowLayout(FlowLayout.LEFT));
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
894 * outerPanel.add(gridPanel); vncContainer.setLayout(new
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
895 * FlowLayout(FlowLayout.LEFT, 30, 16));
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
896 * vncContainer.add(outerPanel); Panel textPanel = new Panel(new
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
897 * FlowLayout(FlowLayout.CENTER)); textPanel.add(errLabel);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
898 * gridPanel.add(textPanel); gridPanel.add(new ReloginPanel(this));
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
899 */
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
900 } else {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
901 /*
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
902 * vncContainer.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 30));
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
903 * vncContainer.add(errLabel);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
904 */
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
905 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
906
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
907 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
908
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
909 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
910 // Stop the applet.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
911 // Main applet thread will terminate on first exception
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
912 // after seeing that rfbThread has been set to null.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
913 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
914
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
915 public void stop() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
916 System.out.println("Stopping applet");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
917 rfbThread = null;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
918 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
919
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
920 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
921 // This method is called before the applet is destroyed.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
922 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
923
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
924 public void destroy() {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
925 System.out.println("Destroying applet");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
926
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
927 vncContainer.removeAll();
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
928 // options.dispose();
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
929 clipboard.dispose();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
930 if (rec != null)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
931 rec.dispose();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
932 if (rfb != null && !rfb.closed())
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
933 rfb.close();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
934 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
935
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
936 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
937 // Start/stop receiving mouse events.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
938 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
939
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
940 public void enableInput(boolean enable) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
941 vc.enableInput(enable);
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
942 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
943
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
944 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
945 // Close application properly on window close event.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
946 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
947
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
948 public void windowClosing(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
949 System.out.println("Closing window");
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
950 if (rfb != null)
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
951 disconnect();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
952
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
953 vncContainer.hide();
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
954
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
955 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
956
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
957 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
958 // Ignore window events we're not interested in.
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
959 //
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
960
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
961 public void windowActivated(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
962 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
963
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
964 public void windowDeactivated(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
965 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
966
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
967 public void windowOpened(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
968 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
969
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
970 public void windowClosed(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
971 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
972
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
973 public void windowIconified(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
974 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
975
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
976 public void windowDeiconified(WindowEvent evt) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
977 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
978
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
979 public void setClientSocket(Socket sock) {
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
980 clientSocket = sock;
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
981 }
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
982
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
983 public void start() {
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
984
61
646e6fc14d62 modify some files. for to use Client with CUI
e085711
parents: 60
diff changeset
985 }
65
4225c2fd3e16 modify CuiMyVncClient.java
e085711
parents: 61
diff changeset
986
60
18a19d8a09f4 add some files. for to use Client with CUI.
e085711
parents:
diff changeset
987 }