import java.io.*; import java.net.*; class EchoServer { public static void main(String args[]) throws Exception { String clientstr; String fwdstr; ServerSocket ssock = new ServerSocket(5678); while(true) { Socket conn = ssock.accept(); BufferedReader inFromClient =new BufferedReader(new InputStreamReader(conn.getInputStream())); DataOutputStream outToClient =new DataOutputStream(conn.getOutputStream()); clientstr = inFromClient.readLine(); System.out.println("Input from the Client: "+clientstr); fwdstr = clientstr+ '\n'; outToClient.writeBytes(fwdstr); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)