Answering my own question here.
In the end I used netcat and upnpc.
I used upnpc to open a port in my router, then netcat open a server, and netcat again to remotely connect to the same server.
Here's the one-liner I came up with:
gnome-terminal --command="nc -l -p 4040" & while true; do echo `date` hello; sleep 2; done | nc `upnpc -a 10.0.0.3 4040 4040 tcp | grep 'ExternalIPAddress' | sed 's/ExternalIPAddress = //g'` 4040
Here's one without upnpc (assumes you've already done the port forwarding):
gnome-terminal --command="nc -l -p 4040" & while true; do echo `date` hello; sleep 2; done | nc `curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'` 4040
First it opens a new terminal window, giving it the command "nc -l -p 4040" just to open a server.
Then in the current window, it runs upnpc to open port in the router (which also gives external IP, second one-liner just grabs external IP and thats it). Then connects to external IP and port and infinitely sends the date & time. You'll know when it disconnected by the last date and time sent.
My internet was dropping the connection approx every 10 mins.