grab ip automatically for sensor

now does both null check and isConnected check for socket