Checking for existence of port before querying for it.