Mercurial > hg > Applications > TightVNC_orginal
comparison src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java @ 42:fe38611c4b2b
change the location of the call cleanUpSession().
author | one |
---|---|
date | Thu, 25 Oct 2012 19:38:20 +0900 |
parents | 3c072f2f39bb |
children | 6687aa9dd55e |
comparison
equal
deleted
inserted
replaced
41:0f260079879f | 42:fe38611c4b2b |
---|---|
73 private ConnectionParams connectionParams; | 73 private ConnectionParams connectionParams; |
74 private final ProtocolSettings settings; | 74 private final ProtocolSettings settings; |
75 private final UiSettings uiSettings; | 75 private final UiSettings uiSettings; |
76 private AcceptThread acceptThread; | 76 private AcceptThread acceptThread; |
77 private GetBroadCastProxy getCast; | 77 private GetBroadCastProxy getCast; |
78 | |
79 private Protocol tempWorkingProtocol; | |
78 | 80 |
79 | 81 |
80 public static void main(String[] argv) { | 82 public static void main(String[] argv) { |
81 String[] mainArgs = argv; | 83 String[] mainArgs = argv; |
82 System.out.println(mainArgs.length); | 84 System.out.println(mainArgs.length); |
157 connectionManager.setContainerFrame(containerFrame); | 159 connectionManager.setContainerFrame(containerFrame); |
158 updateFrameTitle(); | 160 updateFrameTitle(); |
159 containerFrame.dispose(); | 161 containerFrame.dispose(); |
160 containerFrame = null; | 162 containerFrame = null; |
161 workingProtocol.startNormalHandling(this, surface, clipboardController,rfb); | 163 workingProtocol.startNormalHandling(this, surface, clipboardController,rfb); |
164 if(tempWorkingProtocol!=null) | |
165 tempWorkingProtocol.cleanUpSession(); | |
162 // rfb.setInitData(workingProtocol.getInitData()); too early | 166 // rfb.setInitData(workingProtocol.getInitData()); too early |
163 // workingProtocol.startNormalHandling(this, surface, clipboardController); | 167 // workingProtocol.startNormalHandling(this, surface, clipboardController); |
164 tryAgain = false; | 168 tryAgain = false; |
165 } catch (UnsupportedProtocolVersionException e) { | 169 } catch (UnsupportedProtocolVersionException e) { |
166 connectionManager.showReconnectDialog("Unsupported Protocol Version", e.getMessage()); | 170 connectionManager.showReconnectDialog("Unsupported Protocol Version", e.getMessage()); |
281 } catch (IOException e) { /*nop*/ } | 285 } catch (IOException e) { /*nop*/ } |
282 } | 286 } |
283 } | 287 } |
284 | 288 |
285 private void createSocketAndSend(LinkedList<String> clientList,String port) throws UnknownHostException, IOException { | 289 private void createSocketAndSend(LinkedList<String> clientList,String port) throws UnknownHostException, IOException { |
286 int i = 0; | 290 boolean passFlag = false; |
287 for(String client : clientList) { | 291 for(String client : clientList) { |
288 if(i!=0) { | 292 if(passFlag) { |
289 Socket echoSocket; | 293 Socket echoSocket; |
290 echoSocket = new Socket(client, 10001); | 294 echoSocket = new Socket(client, 10001); |
291 DataOutputStream os = new DataOutputStream(echoSocket.getOutputStream()); | 295 DataOutputStream os = new DataOutputStream(echoSocket.getOutputStream()); |
292 os.writeBytes("reconnection\n"); | 296 os.writeBytes("reconnection\n"); |
293 os.writeBytes(port+"\n"); | 297 os.writeBytes(port+"\n"); |
294 os.close(); | 298 os.close(); |
295 } | 299 } |
296 i++; | 300 passFlag = true; |
297 } | 301 } |
298 } | 302 } |
299 | 303 |
300 public void changeVNCServer(String hostName) throws UnknownHostException, IOException { | 304 public void changeVNCServer(String hostName) throws UnknownHostException, IOException { |
301 // sender and reader | 305 // sender and reader stop |
302 workingProtocol.cleanUpSession(); | 306 tempWorkingProtocol = workingProtocol; |
303 // run call and change workingProtocol | 307 // run call and change workingProtocol |
304 this.connectionParams.hostName = hostName; | 308 this.connectionParams.hostName = hostName; |
305 this.run(); | 309 this.run(); |
306 this.createConnectionAndStart(); | 310 this.createConnectionAndStart(); |
307 createSocketAndSend(aClient.getList(),String.valueOf(opendPort)); | 311 createSocketAndSend(aClient.getList(),String.valueOf(opendPort)); |