// $ java Actualizador import java.net.*; import java.io.*; import java.util.Scanner; public class Actualizador { public static void main(String[] args) throws IOException { int port=Integer.parseInt(args[1]); Socket socket = new Socket(args[0], port); Scanner in = new Scanner(System.in); try { PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())),true); while(true) { double precio = in.nextDouble(); if (precio < 0) System.exit(0); out.println(precio); } } finally { System.out.println("closing..."); socket.close(); } } }