File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ package test ;
2
+
3
+ import java .net .*;
4
+
5
+ public class EgressDiagnostics {
6
+ public static void main (String [] args ) throws SocketException {
7
+ System .out .println (System .getProperties ());
8
+ tryRemote (new InetSocketAddress ("a.root-servers.net" , 0 ));
9
+ tryRemote (new InetSocketAddress ("a.root-servers.net" , 53 ));
10
+ tryRemote (new InetSocketAddress ("1.1.1.1" , 0 ));
11
+ tryRemote (new InetSocketAddress ("1::1" , 0 ));
12
+ }
13
+
14
+ public static void tryRemote (InetSocketAddress remote ) {
15
+ DatagramSocket socket = null ;
16
+ try {
17
+ System .out .println ("\n remote: " + remote );
18
+ socket = new DatagramSocket ();
19
+ socket .connect (remote );
20
+ InetAddress local = socket .getLocalAddress ();
21
+ System .out .println ("local: " + local );
22
+ NetworkInterface ni = NetworkInterface .getByInetAddress (local );
23
+ System .out .println ("interface: " + ni );
24
+ System .out .println ("hardware: " + ni .getHardwareAddress ());
25
+ } catch (Throwable t ) {
26
+ System .out .println (t );
27
+ t .printStackTrace ();
28
+ } finally {
29
+ if (socket != null ) {
30
+ socket .close ();
31
+ }
32
+ }
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments