Java code to listing Network Interface Addresses run on Windows 10

One of the most useful pieces of information you can get from a network interface is the list of IP addresses that are assigned to it. You can obtain this information from a NetworkInterface instance by using one of two methods. The first method, getInetAddresses(), returns an Enumeration of InetAddress. The other method, getInterfaceAddresses(), returns a list of java.net.InterfaceAddress instances. This method is used when you need more information about an interface address beyond its IP address. For example, you might need additional information about the subnet mask and broadcast address when the address is an IPv4 address, and a network prefix length in the case of an IPv6 address. ~ https://docs.oracle.com/javase/tutorial/networking/nifs/listing.html

The following example program lists all the network interfaces and their addresses on a machine (tested on PC running Windows 10):
package javalistinetaddress;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.Enumeration;

public class JavaListInetAddress {

public static void main(String[] args) throws SocketException {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets))
displayInterfaceInformation(netint);
}

static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {
System.out.printf("Display name: %s ", netint.getDisplayName());
System.out.printf("Name: %s ", netint.getName());
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses)) {
System.out.printf("InetAddress: %s ", inetAddress);
}
System.out.printf(" ");
}

}



Related:
- Java code to listing Network Interface Addresses, run on Raspberry Pi/Raspbian Jessie

Read More..

an add on for this website failed to run Adsense Adchoice Ad sense Ad choice

Internet Explorer 8 or Internet Explorer 9 show "An add on for this website failed to run" across the top of a web page, then tells you to check "Security Settings".

You check the security settings and try all combinations, but the darn message still appears!

IE8 and IE9 are very poor browsers. Microsoft technicians drink coffee all day long and generally dont know what the public wants, or ignores users complaints.

There is a simple solution that Microsoft clearly doesnt know about. Perhaps they do know and want to leave customers in a state of frustration.


SOLUTION

Go to "Tools", "Internet Options", "Security", "Restricted sites", "sites".

Cursor down until you find "doubleclick.net".

Remove it. Click "Close". Click "Okay".


It is done. You will have no more problems.
Read More..

Blog Archive

Powered by Blogger.