/***************************** Para ejecutar: 1.- Instale Java Standard Edition development Kit (JDK) si no lo tiene http://java.sun.com 2.- Configure adecuadamente la variable de ambiente PATH . 3.- Edite este archivo para reflejar la máquina donde corre el servidor. 4.- Compile el programa con: % javac TCPClient.java 5.- Ejecute el programa con: % java TCPClient *******************************/ import java.io.*; import java.net.*; class TCPClient { public static void main(String argv[]) throws Exception { String sentence; String modifiedSentence; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); Socket clientSocket = new Socket("200.1.17.17", 6789); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); sentence = inFromUser.readLine(); outToServer.writeBytes(sentence + '\n'); modifiedSentence = inFromServer.readLine(); System.out.println("FROM SERVER: " + modifiedSentence); clientSocket.close(); } }