Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java @ 232:6ee4cdca104c
send value of port and localhost in checkdelay framebufferupdate, and get this.
author | oc |
---|---|
date | Fri, 10 Oct 2014 23:39:44 +0900 |
parents | b31903e5b02d |
children | 1d4d5055a288 |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; import java.io.IOException; import com.glavsoft.viewer.ViewerInterface; import com.glavsoft.viewer.swing.ConnectionParams; public class CreateConnectionParam { private String hostName; private int portNumber = ConnectionParams.DEFAULT_VNC_ROOT; private TreeRFBProto rfb; private String myHostName; public CreateConnectionParam(TreeRFBProto rfb) { this.rfb = rfb; } public synchronized void findTreeVncRoot() throws InterruptedException { rfb.createRootSelectionPanel(this); FindRoot getBcast = new FindRoot(rfb.acceptPort,this); getBcast.findRoot(); // wait for RootSelection wait(); } /** * To find parent, send WHERE_TO_CONNECT command to the TreeVNC root * Incoming CONNECT_TO message is handled in MyRFBProto * @param v */ public void sendWhereToConnect(ViewerInterface v) { rfb.setConnectionParam(this); TreeVncProtocol echo = new TreeVncProtocol(hostName,portNumber); try { echo.whereToConnect(myHostName,rfb.getAcceptPort()); } catch (IOException e) { System.out.println("cannot connect to root "+e.getMessage()); } } public synchronized void setHostName(String _hostName, int port, String _myHostName) { hostName = _hostName; portNumber = port; myHostName = _myHostName; notify(); } public void setHostName(String hostAndPort) { int i = hostAndPort.indexOf(':'); if (i>0) { portNumber = Integer.parseInt(hostAndPort.substring(i+1)); hostName = hostAndPort.substring(0,i); } else hostName = hostAndPort; // who sets myHostName? } public String getMyHostName() { return myHostName; } public int getPort() { return portNumber; } public String getHostName() { return hostName; } }