public static InetAddress getLocalHost ( ) throws UnknownHostException { InetAddress addr ; try { addr = InetAddress . getLocalHost ( ) ; } catch ( ArrayIndexOutOfBoundsException e ) { //this is workaround for mac osx bug see AS7-3223 and JGRP-1404 addr = InetAddress . getByName ( null ) ; } return addr ; }
Methods returns InetAddress for localhost