Exemple #1
0
  public void run() {
    CConn cc = null;
    Socket sock = null;
    if (listenMode.getValue()) {
      int port = 5500;
      ServerSocket listener = null;
      if (vncServerName.getValue() != null && Character.isDigit(vncServerName.getValue().charAt(0)))
        port = Integer.parseInt(vncServerName.getValue());

      try {
        listener = new ServerSocket(port);
      } catch (IOException e) {
        System.out.println("Could not listen on port: " + port);
        System.exit(-1);
      }

      vlog.info("Listening on port " + port);

      try {
        sock = listener.accept();
        listener.close();
      } catch (IOException e) {
        System.out.println("Accept failed: " + port);
        System.exit(-1);
      }
    }
    try {
      cc = new CConn(this, sock, vncServerName.getValue(), false);
      while (true) cc.processMsg();
    } catch (EndOfStream e) {
      vlog.info(e.toString());
    } catch (java.lang.Exception e) {
      if (cc != null) cc.deleteWindow();
      if (cc == null || !cc.shuttingDown) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(
            null, e.toString(), "VNC Viewer : Error", JOptionPane.ERROR_MESSAGE);
      }
    }
    if (cc != null) cc.deleteWindow();
    nViewers--;
    if (!applet && nViewers == 0) {
      System.exit(0);
    }
  }
Exemple #2
0
 public static void usage() {
   String usage =
       ("\nusage: vncviewer [options/parameters] "
           + "[host:displayNum] [options/parameters]\n"
           + "       vncviewer [options/parameters] -listen [port] "
           + "[options/parameters]\n"
           + "\n"
           + "Options:\n"
           + "  -log <level>    configure logging level\n"
           + "\n"
           + "Parameters can be turned on with -<param> or off with "
           + "-<param>=0\n"
           + "Parameters which take a value can be specified as "
           + "-<param> <value>\n"
           + "Other valid forms are <param>=<value> -<param>=<value> "
           + "--<param>=<value>\n"
           + "Parameter names are case-insensitive.  The parameters "
           + "are:\n\n"
           + Configuration.listParams());
   System.err.print(usage);
   System.exit(1);
 }