Try out autossh if you're not on Windows, and desire a persistent connection -- http://www.harding.motd.ca/autossh/
autossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic. The idea is from rstunnel (Reliable SSH Tunnel), but implemented in C.