private void openSocket() { try { if (port == NetworkConfiguration.CLIENT_PORT) _mySocket = main._clientSocket = new ServerSocket(port); else _mySocket = main._deviceSocket = new ServerSocket(port); Logger.info("[GestureServer] Socket Open: " + port); main.myState = JmolGestureServerInterface.OK; } catch (IOException e) { Logger.error("[GestureServer] Failed to open a server socket."); e.printStackTrace(); main.myState = 0; } }
/** * @param socket * @throws IOException */ private void acceptClientConnection(Socket socket) throws IOException { Logger.info("[GestureServer] Client connection accepted"); ClientConnection cc = new ClientConnection(socket); main._clients.add(cc); if (main.ic == null) { cc.processError(EventType.DRIVER_NONE); } else { main.myState |= JmolGestureServerInterface.HAS_CLIENT; } }
/** notify clients that we lost contact with the input device */ void notifyInputLost() { Logger.error("[GestureServer] sending clients message that input device was lost."); main.ic = null; main.myState &= ~JmolGestureServerInterface.HAS_DRIVER; processBirth(null); }
/** * @param socket * @throws IOException */ private void acceptInputDeviceConnection(Socket socket) throws IOException { Logger.info("[GestureServer] Input device connection accepted"); main.ic = new InputDeviceConnection(this, socket); main.myState |= JmolGestureServerInterface.HAS_DRIVER; }