Posts

Showing posts from March, 2022

1. To develop any distributed application through implementing client-server communication programs based on Java Sockets and RMI techniques.

 /*Assignment No:-01 Title: Design a distributed application which consist of a server and client using threads. */ //MyClient.java import java.net.*; import java.io.*; public class MyClient { public static void main (String args[]) { int n,ch,ch1,fact; String st,st1,st2,first,last;  try { Socket s = new Socket(args[0], 2001); DataInputStream in = new DataInputStream( s.getInputStream()); DataOutputStream out =new DataOutputStream( s.getOutputStream()); BufferedReader object = new BufferedReader(new InputStreamReader(System.in)); do  {  System.out.println("1.Factorial\n2.Adddition of digits\n3.String operations\n4.Exit\nEnter ur choice:");  ch= Integer.parseInt(object.readLine()); out.writeUTF(Integer.toString(ch)); switch(ch) { case 1: System.out.println("Enter a number="); n=Integer.parseInt(object.readLine());  out.writeUTF(Integer.toString(n)); fact=Integer.parseInt(in.readUTF()); System.out.println("Factorial of "+n+"is "+fact) ;  break; cas...