-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRouterow.java
More file actions
39 lines (34 loc) · 1.08 KB
/
TestRouterow.java
File metadata and controls
39 lines (34 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
29
30
31
32
33
34
35
36
37
38
39
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Created by PM on 2015-01-24.
*/
class SnifferNetowy {
public void szukaj() throws Exception {
String komenda = "tracert";
String OS = System.getProperty("os.name").toLowerCase();
if (OS.indexOf("win")>=0) {
komenda = "tracert";
} else {
komenda = "traceroute";
}
Runtime r = Runtime.getRuntime();
Process p = r.exec(komenda + " google.pl");
p.waitFor();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String linia = "";
while (true) {
linia = br.readLine();
if (linia == null) break;
System.out.println(linia);
}
}
}
public class TestRouterow {
public static void main(String[] args) throws Exception{
double[] T = {0.3, 0.6, 4.8, 6.3, 15.1};
//wyliczyc odleglosci miedzy kolejnymi liczbami; czyli
//roznice miedzy "nastepnymi" i "poprzednimi" liczbami.
new SnifferNetowy().szukaj();
}
}