1. Home
  2. Docs
  3. Network Programming
  4. Internet Address
  5. The Network Interface Class

The Network Interface Class

The NetworkInterface class represents a local IP address. This can either be a physical interface such as an additional Ethernet card (common on firewalls and routers) or it can be a virtual interface bound to the same physical hardware as the machine’s other IP addresses. The NetworkInterface class provides methods to enumerate all the local addresses, regardless of interface, and to create InetAddress objects from them. These InetAddress objects can then be used to create sockets, server sockets, and so forth.

Factory Method

public static NetworkInterface getByName(String name) throws SocketException

public static NetworkInterface getByInetAddress(InetAddress address) throws SocketException

public static Enumeration getNetworkInterfaces() throws SocketException

Getter Method

public Enumeration getInetAddresses()

public String getName()

public String getDisplayName()


Was this article helpful to you? Yes No

How can we help?