detecting already mapped port, finding available port if taken