The reason that the IP 127.0.0.1 works is beacause thats the IP of something called localhost. Since you are hosting both the server and the client on the machine that works just fine.
When you want to have lets say the server program on one computer and client on another inside your local network (only accessed from inside of your network) you have to point the IP adress of the client to your server's IP adress.
But things are a bit diffrent when you want to access it from OUTSIDE of your network. Its similar to before, just that you have to port forward your server's IP from your router with the port (6789 in your case). What this does is that when your routers public IP receives data with the port 6789, it knows where to send it. If it doesen't know, it just discards it.
When you have port forwarded your router to accept data from port 6789. You need to find out your public IP adress. (which is farily easy to do, just head to: http://www.whatsmyip.org/) Then from outside your local network, start up your client on a computer. Then replace the IP that the client shall connect with to whatever your public IP is.
NOTE: Your router's public IP adress changes from time to time, so that if you try to connect one day your routers public IP may have changed. A way to avoid this is to use DDNS (dynamic domain name system) but that is another topic.
Hope this helps!
-Kad