Mercurial > hg > Applications > TreeVNC
changeset 340:fd529c51095f
add port ScreenChangeRequest value.
author | oc |
---|---|
date | Fri, 06 Feb 2015 19:19:14 +0900 |
parents | 4713559f5838 |
children | 1d9a4099ad44 |
files | src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java |
diffstat | 3 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java Fri Feb 06 19:06:50 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java Fri Feb 06 19:19:14 2015 +0900 @@ -21,9 +21,11 @@ private short id; private int frameSizeWidth; private int frameSizeHeight; + private int port; - public ScreenChangeRequest(String adr, short id, int width, int height) { + public ScreenChangeRequest(String adr, int port, short id, int width, int height) { this.bytes = adr; + this.port = port; this.id = id; this.frameSizeWidth = width; this.frameSizeHeight = height; @@ -41,12 +43,13 @@ out.put(bytes.getBytes()); out.putInt(frameSizeWidth); out.putInt(frameSizeHeight); + out.putInt(port); writer.write(out.array(), 0, out.position()); writer.flush(); } @Override public String toString() { - return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes); + return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes) + " : " + port; } } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Fri Feb 06 19:06:50 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Fri Feb 06 19:19:14 2015 +0900 @@ -215,8 +215,9 @@ String newHostName = new String(byteAddress, "UTF-8"); int frameSizeWidth = buf.getInt(); int frameSizeHeight = buf.getInt(); - System.out.println("Root server change request :" + newHostName); - changeVNCServer(viewer, newHostName, frameSizeWidth, frameSizeHeight, id); + int port = buf.getInt(); + System.out.println("Root server change request :" + newHostName + " : " + port); + changeVNCServer(viewer, newHostName, port, frameSizeWidth, frameSizeHeight, id); if (viewer != null) { viewer.setFitScreen(); } @@ -794,7 +795,7 @@ * FrameHeight * @param id */ - public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int width, int height, short id) + public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int port, int width, int height, short id) throws IOException { this.frameSizeWidth = width; @@ -807,12 +808,12 @@ } // if have a parent, send serverChangeRequest to the parent with myAddress and port. if (hasParent()) - context.sendMessage(new ScreenChangeRequest(myAddress, (short) -1, width, height)); + context.sendMessage(new ScreenChangeRequest(myAddress, acceptPort, (short) -1, width, height)); if (id == -1) { // change to the tree vnc root on other network. // send whereToConnect. cp = new CreateConnectionParam(this); - cp.setHostName(hostName, ConnectionParams.DEFAULT_VNC_ROOT, myAddress); + cp.setHostName(hostName, port, myAddress); cp.sendWhereToConnect(viewer); stopReceiverTask(); return;
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Fri Feb 06 19:06:50 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingViewerWindow.java Fri Feb 06 19:19:14 2015 +0900 @@ -863,7 +863,7 @@ return; } String adr = viewer.getRfb().getMyAddress(); - context.sendMessage(new ScreenChangeRequest(adr, viewer.getRfb().getId(), singleWidth, singleHeight)); + context.sendMessage(new ScreenChangeRequest(adr, ConnectionParams.DEFAULT_RFB_PORT, viewer.getRfb().getId(), singleWidth, singleHeight)); } }); kbdButtons.add(screenButton); @@ -1010,7 +1010,7 @@ private void changeVncServer(ViewerInterface viewer, int width, int height, short id) { String localhost = "127.0.0.1"; try { - viewer.getRfb().changeVNCServer(viewer, localhost, width, height, id); + viewer.getRfb().changeVNCServer(viewer, localhost, ConnectionParams.DEFAULT_RFB_PORT, width, height, id); } catch (Exception e1) { System.out.println("can't change server :" + e1.getMessage()); }