aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2012-04-14 03:20:47 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2012-04-14 03:20:47 +0000
commitc1fcef03cdf37d6bfa3b552985a5b9e6b4f26e69 (patch)
tree1f5ed7d3cf34bec49e8c9ba0dfdae56be422cd59
parent9580634afdca440942409e942633c54b8d780f36 (diff)
downloadtigervnc-c1fcef03cdf37d6bfa3b552985a5b9e6b4f26e69.tar.gz
tigervnc-c1fcef03cdf37d6bfa3b552985a5b9e6b4f26e69.zip
Allows java client in listen mode to continue listening and spawning new viewers after the first connection is made.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4891 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--java/com/tigervnc/vncviewer/VncViewer.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/java/com/tigervnc/vncviewer/VncViewer.java b/java/com/tigervnc/vncviewer/VncViewer.java
index 850f5f1f..6729521f 100644
--- a/java/com/tigervnc/vncviewer/VncViewer.java
+++ b/java/com/tigervnc/vncviewer/VncViewer.java
@@ -228,13 +228,17 @@ public class VncViewer extends java.applet.Applet implements Runnable
firstApplet = true;
}
- public static void newViewer(VncViewer oldViewer) {
+ public static void newViewer(VncViewer oldViewer, Socket sock) {
VncViewer viewer = new VncViewer();
viewer.applet = oldViewer.applet;
viewer.firstApplet = false;
+ viewer.sock = sock;
viewer.start();
}
+ public static void newViewer(VncViewer oldViewer) {
+ newViewer(oldViewer, null);
+ }
public void init() {
vlog.debug("init called");
@@ -289,7 +293,6 @@ public class VncViewer extends java.applet.Applet implements Runnable
public void run() {
CConn cc = null;
- Socket sock = null;
/* Tunnelling support. */
if (via.getValueStr() != null) {
@@ -324,10 +327,9 @@ public class VncViewer extends java.applet.Applet implements Runnable
vlog.info("Listening on port "+port);
while (true) {
- sock = listener.accept();
- if (sock != null)
- break;
- //listener.close();
+ Socket new_sock = listener.accept();
+ if (new_sock != null)
+ newViewer(this, new_sock);
}
}
@@ -456,6 +458,7 @@ public class VncViewer extends java.applet.Applet implements Runnable
8);
Thread thread;
+ Socket sock;
boolean applet, firstApplet, stop;
Image logo;
static int nViewers;