My head ain't right at the moment but that error means 1 of 2 things:
1) You can't access that IP address
2) You're hitting a port where nobody is listening.
How to fix:
1. Ping the IP. If you can reach it goto step 2. Otherwise figure out why you can't ping it.
2. On the remote system (note: remote could be the same box if your IP is 127.0.0.1, commonly known as localhost. Hint: this is a great way to debug your stuff) ensure your server is running.
a) It's not. Start it.
b) It is. Debug it That is, debug the server, not the client.
c) You don't own the IP address. This is a whole 'nuther issue I won't touch here. But, um, cough, nmap -sP IP/8 could be a start.