operating system
/** * An echo client. The client enters data to the server, and the * server echoes the data back to the client. */ import java.net.*; import java.io.*; public class EchoClient { //Your code is here public static void main(String[] args) { try { Socket s = new Socket("localhost", 1000); BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter w = new PrintWriter(s.getOutputStream(), true); BufferedReader con = new BufferedReader(new InputStreamReader(System.in)); String line; do { line = r.readLine(); if ( line != null ) System.out.println(line); line = con.readLine(); w.println(line); } while ( !line.trim().equalsIgnoreCase(("bye"))); } catch (Exception e) { System.out.println(e); } } }