Reputation: 259
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
?
Upvotes: 2
Views: 157
Reputation: 98620
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
.
Upvotes: 2