1
2
3
4
5
6
7
8
9
10
11 import java.io.*;
12 import java.net.*;
13
14 public class Cliente{
15 public static final int puerto = 9999;
16
17 public static void main(String[] args) throws IOException{
18 Socket socket;
19 PrintStream salida;
20 String mensaje;
21 BufferedReader teclado = new BufferedReader(new InputStreamReader(System.in));
22
23 socket = new Socket("localhost", puerto);
24 salida = new PrintStream(socket.getOutputStream());
25 while((mensaje = teclado.readLine()) != null){
26 salida.println(mensaje);
27 }
28 socket.close();
29 }
30 }
31