Remote SSH connection
Yes, the numbers 49884 and 49886 you see are indeed port numbers. However, they're not port numbers for the ssh service itself, but are the port numbers these specific clients have used for connecting. The numbers are essentially meaningless for you.

The usual problem that home users have with connecting remotely over SSH to their own computer is that their network is behind a NAT (Network Address Translation) router. Essentially this means that your router has a single public IP address, but allows multiple devices behind it to connect to the internet even though they have private IP addresses that are not "visible" on the internet.

The most common way to enable remote access over SSH is to add a port forward in the router. You'll need to port forward your remote IP port 22 to port 22 on the local IP of your iMac. How that is done depends on the exact router you have, but is usually explained in the manual or web interface help.