-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactClient.java
More file actions
27 lines (23 loc) · 810 Bytes
/
FactClient.java
File metadata and controls
27 lines (23 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.net.Socket;
import java.io.*;
public class FactClient{
public static void main(String []a){
try{
//connection
Socket soc=new Socket("localhost",12345);
System.out.println("Client");
//take input from user
BufferedReader userInput=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Number:");
int str=Integer.parseInt(userInput.readLine());
//pass to Server
PrintWriter out = new PrintWriter(soc.getOutputStream(),true);
out.println(str);
BufferedReader in =new BufferedReader(new InputStreamReader(soc.getInputStream()));
// int num2=Integer.parseInt(in.readLine());
System.out.println("Factorial is:"+in.readLine());
}catch(Exception e){
e.printStackTrace();
}
}
}