-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomNetworking4.java
More file actions
23 lines (19 loc) · 860 Bytes
/
CustomNetworking4.java
File metadata and controls
23 lines (19 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.net.*;
import java.util.*;
class CustomNetworking4{
public static void main(String[] args) throws Exception{
Enumeration<NetworkInterface> networkInterfaces= NetworkInterface.getNetworkInterfaces();
for(NetworkInterface net : Collections.list(networkInterfaces)){
System.out.println("Display name :"+net.getDisplayName());
System.out.println("Name :"+net.getName());
displaySubInterfaces(net);
}
}
public static void displaySubInterfaces(NetworkInterface net){
Enumeration<NetworkInterface> nets=net.getSubInterfaces();
for(NetworkInterface sub : Collections.list(nets)){
System.out.println("\tSub interface display name :"+sub.getDisplayName());
System.out.println("\tSub interface Name :"+sub.getName());
}
}
}