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,292
  • 4
  • 37
  • 70
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
  • 92,924
  • 10
  • 193
  • 247