Untitled
unknown
plain_text
a month ago
792 B
2
Indexable
Never
import java.io.*; import java.net.*; import java.lang.*; public class ServerEcho { public static void main(String q[]) throws IOException { System.out.println("Hello welcome...."); ServerSocket ss=new ServerSocket(8001); //listening System.out.println("\nServer Running....."); //while(true) // { System.out.println("\nServer wait for Client request...."); Socket cs=ss.accept(); //binding System.out.println("Server established connection...."); DataInputStream in=new DataInputStream(cs.getInputStream()); String msg=in.readUTF(); System.out.println("Message From Client: " + msg); DataOutputStream out=new DataOutputStream(cs.getOutputStream()); out.writeUTF("HI I am Server..Length ="+msg.length()+"\n"); //} } }
Leave a Comment