function to get ip address