How to keep wifi alive on Android when the screen is off —26 December 2010
By default, Android loses wifi connection approximately 15 minutes after the screen turns off.
To change this, go to Settings / Wireless controls / Wi-Fi settings, then press the menu button, choose Advanced, and then Wi-Fi sleep policy.
This is on HT-03A, also known as HTC Magic.