Using the <COMMAND> <K> option ("Connect to Server..." in the Finder), you only have to type the IP address. "AFP://" is default.
First of all, if the other Mac is somewhere else on the internet (i.e. not on the same network as you are), then that other Mac has to be directly connected to the internet, and not behind a router.
If that IP address begins with either of these, then you are sure it is NOT directly connected:
10.xxx.xxx.xxx
169.254.xxx.xxx
172.16.xxx.xxx
192.168.xxx.xxx
If it is a different IP address, then it is possible that it is behind a firewall. If so, then the firewall has to "let through" the AFP protocol (which is IP port number 548).
This is also the case on the Mac itself. The one that has Personal File Sharing active, must either turn off the firewall (sys Prefs), or enable AFP.