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
?
Asked
Active
Viewed 139 times
2
-
Because that's the any they designed it. – user207421 Oct 29 '14 at 20:48
1 Answers
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
.