forked from tishrof/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient1.java
More file actions
28 lines (24 loc) · 1.08 KB
/
Client1.java
File metadata and controls
28 lines (24 loc) · 1.08 KB
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.*;
class client {
public static void main(String args[]) throws IOException {
try {
String str;
Socket client = new Socket("127.0.0.1", 6555);
PrintStream clientOutputStream = new PrintStream(client.getOutputStream());
BufferedReader systemInputStream = new BufferedReader(new InputStreamReader(System.in));
BufferedReader clientInputStream = new BufferedReader(new InputStreamReader(client.getInputStream()));
System.out.println("Chaitanya Soni (201951046)");
System.out.println("CLIENT WINDOW\n\nEnter TheCommand: (1 or 0)");
str = systemInputStream.readLine();
clientOutputStream.println(str);
String s = null;
while ((s = clientInputStream.readLine()) != null) {
System.out.println(s);
}
client.close();
} catch (IOException e) {
System.out.println("Error" + e);
}
}
}