-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClientprog.java
More file actions
28 lines (19 loc) · 776 Bytes
/
Clientprog.java
File metadata and controls
28 lines (19 loc) · 776 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
28
import java.io.*;
import java.net.*;
public class Clientprog {
public static void main(String[] args) throws IOException {
int n1,n2,n3;
DataInputStream dis = new DataInputStream(System.in);
System.out.println("Enter 3 number");
n1 = Integer.parseInt(dis.readLine());
n2 = Integer.parseInt(dis.readLine());
n3 = Integer.parseInt(dis.readLine());
Socket s = new Socket("localHost",100);
DataInputStream dis2 = new DataInputStream(s.getInputStream());
DataOutputStream dos = new DataOutputStream(s.getOutputStream());
dos.writeUTF(n1+" "+n2+" "+n3);
String ans = dis2.readUTF();
System.out.println("Largest element is "+ans);
s.close();
}
}