Using the NetworkInterface class
The NetworkInterface
class provides a means of accessing the devices that act as nodes on a network. This class also provides a means to get low-level device addresses. Many systems are connected to multiple networks at the same time. These may be wired, such as a network card, or wireless, such as for a wireless LAN or Bluetooth connection.
The NetworkInterface
class represents an IP address and provides information about this IP address. A
network interface is the point of connection between a computer and a network. This frequently uses an NIC of some type. It does not have to have a physical manifestation, but it can be performed in software as done with the loopback connection (127.0.0.1
for IPv4 and ::1
for IPv6).
The NetworkInterface
class does not have any public constructors. Three static methods are provided to return an instance of the NetworkInterface
class:
getByInetAddress
: This is used if the IP address is knowngetByName
: This is used if the...