dns-sd, your new best friend
Do you depend on a service running on a remote machine? Are you a cheap ass who can’t afford a static IP? Are you tired of the free dynamic DNS services out there? Well look no further!
If the service in question is running on a machine where the currently logged in (OS) user is logged in to Back to My Mac, you’re safe. Through the marvelous wonders of wide-area Bonjour services, you can list all running services (and corresponding endpoints) of a certain kind within your virtual (Back to My Mac) network by simply invoking…
$ dns-sd -B _ssh
…in your favorite shell (the dns-sd command is a network diagnostic tool, much like ping or traceroute - read its man page for more details).
If this should be too much of a process, Terminal.app can do this auto discovery for you - just invoke the New Remote Connection option, and it will list all (Back to my Mac) machines running a certain service kind.
Magic, isn’t it?