package chat; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.Socket; class Client { public static void main(String argv[]) throws Exception { Queue q = new Queue(); // Thread that reads messages from stdin end queues them KeyboardThread kt = new KeyboardThread(q); kt.start(); Socket clientSocket = new Socket("localhost", 6789); // Thread that reads messages from the queue and sends them to the server ToOtherUserThread ous = new ToOtherUserThread(clientSocket, q); ous.start(); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while(true) { System.out.println("FROM SERVER: " + inFromServer.readLine()); } } }