// -------------------------------------------------- public void run() { String inputLine; try { while ((inputLine = is.readLine()) != null) { responseArea.appendText(inputLine + "\n"); } } catch (IOException e) { responseArea.appendText("IO Exception" + "\n"); } }
// -------------------------------------------------- public void close() { try { is.close(); os.close(); socket.close(); responseArea.appendText("***Connection closed" + "\n"); } catch (IOException e) { responseArea.appendText("IO Exception" + "\n"); } }
// -------------------------------------------------- public BaseTConn(String host, String port, TextArea commandArea, TextArea responseArea) { this.commandArea = commandArea; this.responseArea = responseArea; try { socket = new Socket(host, Integer.parseInt(port)); os = new PrintStream(socket.getOutputStream()); is = new DataInputStream(socket.getInputStream()); responseArea.appendText("***Connection established" + "\n"); new Thread(this).start(); } catch (Exception e) { responseArea.appendText("Exception" + "\n"); } }