Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
668 B
2
Indexable
Never
import java.io.*;
import java.net.*;

public class ClientTestPrg {
	public static void main(String q[]) throws IOException
	{
		Socket sc=new Socket("localhost",8001);
		
		DataOutputStream out=new DataOutputStream(sc.getOutputStream());
		BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
		int number = Integer.parseInt(br.readLine());
		String message = Integer.toString(number);
		out.writeUTF(message);
		System.out.println("Message sent to Server: " + number);
		
		
		DataInputStream in=new DataInputStream(sc.getInputStream());
		String msg=in.readUTF();
		System.out.println("Message From Server: " + msg);
		
		sc.close();
						
	}

}
Leave a Comment