2

For example - public byte[] getHardwareAddress() throws SocketException. The method returns the mac address of a network interface, but how is it related to sockets and ends up throwing SocketException?

janisz
  • 6,100
  • 4
  • 36
  • 68
314314314
  • 249
  • 1
  • 10

1 Answers1

2

On Linux getHardwareAddress() is implemented using SIOCGIFHWADDR ioctl request on a temporarily created datagram socket. Something like this.

Both socket and ioctl system calls may fail. The error will be translated to SocketException.

Community
  • 1
  • 1
apangin
  • 86,266
  • 9
  • 178
  • 218