$port
From Scriptwiki
Returns the port number of the server to which you're currently connected.
$port
- This function has no parameters.
Example
echo -ag $port
Echoes the port used for the active connection to your active window.