public InetAddress getLocalAddress() throws UnknownHostException {
final Collection<Device> devices = DeviceUtils
.getDevicesByAPI(NetDeviceAPI.class);
for (Device dev : devices) {
try {
final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
final ProtocolAddressInfo addrInfo =
api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
if (addrInfo != null) {
final ProtocolAddress addr = addrInfo.getDefaultAddress();
if (addr != null) {
return addr.toInetAddress();
}