Adding checks to connectionIs command to check if the specified ports are within the bounds