network IP retrieving method modified for OS X