-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArk_manager
More file actions
42 lines (33 loc) · 1.04 KB
/
Ark_manager
File metadata and controls
42 lines (33 loc) · 1.04 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.*;
import java.util.*;
public class ARK_manager {
public static void main(String args[])
throws IOException
{
ARK_manager ping = new ARK_manager();
List<String> commands = new ArrayList<String>();
commands.add("ping");
commands.add("-n");
commands.add("5");
commands.add("google.com");
ping.doCommand(commands);
}
public void doCommand(List<String> command)
throws IOException
{
String s = null;
ProcessBuilder pb = new ProcessBuilder(command);
Process process = pb.start();
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(process.getErrorStream()));
System.out.println("Pingin server\n");
while ((s = stdInput.readLine()) != null)
{
System.out.println(s);
}
while ((s = stdError.readLine()) != null)
{
System.out.println(s);
}
}
}