The java files in the repository need a few changes to work correctly with a repeater. Obviously you can omit the console output code.
After the changes are made then use then build and run
javac *.java ;jar cf VncViewer.jar *.class
java -classpath VncViewer.jar VncViewer HOST {Internal Name} PORT {Internal Port} REPEATERHOST {Repeater External Host Name} REPEATERPORT {Repeater External Port}
example
java -classpath VncViewer.jar VncViewer HOST mycomputer PORT 5900 REPEATERHOST repeater.mydomain.com REPEATERPORT 5999
--- JV105Orig/VncViewer.java
+++ JV105/VncViewer.java
@@ -97,6 +97,8 @@
// Variables read from parameter values.
String host;
int port;
+ String repeaterHost;
+ int repeaterPort;
String passwordParam;
String encPasswordParam;
boolean showControls;
@@ -120,7 +122,7 @@
//
public void init() {
-
+ System.out.println("-- INIT --");
readParameters();
if (inSeparateFrame) {
@@ -404,8 +406,11 @@
//
void prologueDetectAuthProtocol() throws Exception {
-
- rfb = new RfbProto(host, port, this, null, 0); // Modif: troessner - sf@2007: not yet used
+ if (repeaterHost != null && repeaterPort > 0) {
+ rfb = new RfbProto(host, port, this, repeaterHost, repeaterPort); // Modif: troessner - sf@2007: not yet used
+ } else {
+ rfb = new RfbProto(host, port, this, null, 0); // Modif: troessner - sf@2007: not yet used
+ }
rfb.readVersionMsg();
@@ -430,8 +435,14 @@
//
boolean tryAuthenticate(String us, String pw) throws Exception {
+ if (repeaterHost != null && repeaterPort > 0) {
+ rfb = new RfbProto(host, port, this, repeaterHost, repeaterPort); // Modif: troessner - sf@2007: not yet used
+ } else {
+ rfb = new RfbProto(host, port, this, null, 0); // Modif: troessner - sf@2007: not yet used
+ }
+
- rfb = new RfbProto(host, port, this, null, 0); // Modif: troessner - sf@2007: not yet used
+ //rfb = new RfbProto(host, port, this, null, 0); // Modif: troessner - sf@2007: not yet used
rfb.readVersionMsg();
@@ -767,7 +778,9 @@
//
public void readParameters() {
+ System.out.println("In an Applet? : " + inAnApplet);
host = readParameter("HOST", !inAnApplet);
+ System.out.println("HOST PARAM : " + host);
if (host == null) {
host = getCodeBase().getHost();
if (host.equals("")) {
@@ -776,7 +789,22 @@
}
String str = readParameter("PORT", true);
+ System.out.println("PORT PARAM : " + str);
port = Integer.parseInt(str);
+
+ repeaterHost = readParameter("REPEATERHOST", !inAnApplet);
+ System.out.println("REPEATERHOST PARAM : " + repeaterHost);
+ if (repeaterHost == null) {
+ host = getCodeBase().getHost();
+ if (host.equals("")) {
+ fatalError("HOST parameter not specified");
+ }
+ }
+
+ String str2 = readParameter("REPEATERPORT", true);
+ System.out.println("REPEATERPORT PARAM : " + str2);
+ repeaterPort = Integer.parseInt(str2);
+
if (inAnApplet) {
str = readParameter("Open New Window", false);
--- JV105Orig/RfbProto.java
+++ JV105/RfbProto.java
@@ -205,11 +205,19 @@
//
RfbProto(String h, int p, VncViewer v, String repeaterHost, int repeaterPort) throws IOException {
+ System.out.println("--RfbProto Constructor--");
+ System.out.println("VncViewer: "+v);
+ System.out.println("HOST: "+h);
+ System.out.println("PORT: "+p);
+ System.out.println("REPEATERHOST: "+repeaterHost);
+ System.out.println("REPEATERPORT: "+repeaterPort);
+ System.out.println("--RfbProto Constructor--");
viewer = v;
host = h;
port = p;
if (repeaterHost != null) {
+ System.out.println("Using Repeater: " + repeaterHost +":"+repeaterPort);
sock = new Socket(repeaterHost, repeaterPort);
doRepeater(sock,host,port);
} else {
@@ -231,11 +239,13 @@
private void doRepeater(Socket sock, String host, int port) throws IOException {
// Read the RFB protocol version
+ System.out.println("Final System Name: " + host +":"+port);
final String buf2 = "";
sock.getOutputStream().write(buf2.getBytes());
DataInputStream is = new DataInputStream(sock.getInputStream());
String line = is.readLine();
+ System.out.println("RFB Protocol Version: " + line);
// Write the ID
//if (!id.startsWith("ID:"))
@@ -316,14 +326,18 @@
switch (authScheme) {
case ConnFailed :
+ System.out.println("Auth Scheme: FAILED");
int reasonLen = is.readInt();
byte[] reason = new byte[reasonLen];
is.readFully(reason);
throw new Exception(new String(reason));
case NoAuth :
+ System.out.println("Auth Scheme: NONE");
case VncAuth :
+ System.out.println("Auth Scheme: VNC");
case MsLogon:
+ System.out.println("Auth Scheme: MsLogon");
return authScheme;
default :