I want to make my phone to a remote, which can send commands to my computer. I have looked at the Socket-framework, which looks promising. Let's say my computer is standing at home, connected to my wifi through my router, and my phone is connected to 3G, while I'm running around town. Is it then possible to connect the two? If yes, which ip-adress do i need to connect to from my phone?
Yes, it can be done.You have to connect to your external IP address (just Google "my IP') and a port number of your choice, open the port on the router firewall and redirect the port to a port on your computer local IP address - I cannot help with that as how to do it is router dependent.
You can use free services such as no-ip.com to have a free domain name so you don't have to keep track of your IP if it changes.