Mega Code Archive

 
Categories / Java Book / 006 Networking
 

0364 NetworkInterface

This class represents a Network Interface made up of a name, and a list of IP addresses assigned to this interface. It is used to identify the local interface on which a multicast group is joined. import java.net.InetAddress; import java.net.NetworkInterface; public class ReportByAddress { static public void main(String args[]) throws Exception { InetAddress ia = InetAddress.getByName("www.google.ca"); NetworkInterface ni = NetworkInterface.getByInetAddress(ia); System.out.println(ni); } }