Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java @ 80:2951dd85e9fc
connect to real connection address instead of bad getLocalAddress().
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 30 Apr 2014 13:43:10 +0900 |
parents | cdf7bbe45885 |
children | f93d0286c2ab |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; import com.glavsoft.viewer.ViewerImpl; import jp.ac.u_ryukyu.treevnc.client.EchoClient; import jp.ac.u_ryukyu.treevnc.client.GetDataClient; import jp.ac.u_ryukyu.treevnc.client.GetHostClient; public class CreateConnectionParam { private String hostName; private int portNumber; private MyRfbProto rfb; public CreateConnectionParam(MyRfbProto rfb) { this.rfb = rfb; } public void communicationToProxy() { GetHostClient bCast = new GetHostClient("who"); bCast.getHost(); GetDataClient getBcast = new GetDataClient(); // we should try this in a loop until get correct hostName Thread runBcast = new Thread(getBcast); runBcast.start(); hostName = getBcast.textAddress(); portNumber = Integer.parseInt(getBcast.textPort()); getBcast.interrupt(); } public void createConnectionParam(ViewerImpl v) { EchoClient echo = new EchoClient(hostName, 9999); rfb.setEcho(echo); rfb.setProxyAddr(hostName); echo.getParentName(); v.setConnectionParam(echo.getParentsAddress(), portNumber); runAcceptThread(); } private void runAcceptThread() { Thread accThread = new Thread(new AcceptThread(rfb, portNumber)); accThread.start(); } public void setHostName(String _hostName) { hostName = _hostName; portNumber = 5999; } }