Mercurial > hg > Applications > TreeVNC
changeset 67:2908e4b95b0a
add file
author | Taninari YU <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 01 Feb 2014 07:48:16 +0900 |
parents | 84ad879891e9 |
children | e6550afe663b |
files | src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java |
diffstat | 1 files changed, 55 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Sat Feb 01 07:48:16 2014 +0900 @@ -0,0 +1,55 @@ +package jp.ac.u_ryukyu.treevnc; + +import java.util.Map; + +import com.glavsoft.viewer.Viewer; +import com.glavsoft.viewer.ViewerImpl; +import com.glavsoft.viewer.mvp.View; +import com.glavsoft.viewer.swing.ConnectionParams; + +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(); + 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; + } + +}