For practice I've been working on making a very simple instant messenger program in Java. I have a server and a client made up already using port 5000. I have the client's Socket IP configuration set to the loopback interface for testing purposes. My problem is getting connected to the server... I can't! It never is able to connect. I've tried connecting across my network, and the internet... all have failed...

What am I doing wrong here?

Also, once I do get this up and running I'll have a computer with the server running constantly on it behind two routers. Let's use the IP 126.25.24.23 as an example for my IP address. In order for the client to connect to this server from an outside network, all I have to do is set the socket's IP to "126.25.24.23" then forward all requests for port 5000 to that machine, right?