new method to query ip address for AP or client
removal of redundant code