Zend certified PHP/Magento developer

How to confirm the port is available before connecting with reverse SSH

To set a reverse SSH connection I specify the ssh -R command line flag followed by a remote machine’s port 2210 to map it to a localhost:22 of the machine requesting a reverse ssh connection:

ssh -R 2210:localhost:22  user-001@ec1-23-456-789-0.compute-1.amazonaws.com

Is there a way to check if the remote port 2210 is already in use and raise an error if if the port is not available?