Code freezes if dsl line is down

If your code uses dns to resolve the domain name of the server, the dns server is not localnet, and the dsl is down, that code will never connect. If the internet part is down, the length of the delay will not matter. If your code can't connect, it can't connect.

Actually, you are lucky. Normally PaulS will refer you to http://www.snippets-r-us.com. Please post all your code.