defined IPaddr_init() to find local IP address via getsockname()