-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRCEClient.java
More file actions
31 lines (24 loc) · 927 Bytes
/
RCEClient.java
File metadata and controls
31 lines (24 loc) · 927 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
29
30
31
import java.io.*;
import java.net.*;
public class RCEClient {
public static void main(String[] args) {
try {
Socket s = new Socket("localhost", 5000);
BufferedReader input = new BufferedReader(
new InputStreamReader(s.getInputStream()));
PrintWriter output = new PrintWriter(s.getOutputStream(), true);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
System.out.print("Enter command: ");
String command = br.readLine();
output.println(command);
String response;
while (!(response = input.readLine()).equals("END")) {
System.out.println(response);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}