/** * Closes the connection. * * @exception IOException if an I/O error occurs when closing the socket */ public void close() throws IOException { if (socket == null) return; socket.close(); socket = null; in = null; out = null; }
protected void init() throws IOException { if (address != null) socket = new Socket(address, port); else socket = new Socket(host, port); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = socket.getOutputStream(); }