import java.net.*; import java.io.*; public class Client { public Client() { try { // Connect to server at a specific location Socket s = new Socket("localhost", 5155); // The BufferedReader gives us a buffer of chars (converted from bytes) InputStream in = s.getInputStream(); BufferedReader bin = new BufferedReader (new InputStreamReader(in)); // Read a line from the socket and print it System.out.println(bin.readLine()); // Clean up s.close(); } catch (java.io.IOException e) { System.out.println(e); System.exit(1); } } public static void main(String args[]) { Client client = new Client(); } };