Step #1 
Go To Settings

Step #2
Choose General and then press the Auto-Lock option

Step #3
From the timeout options displayed, select the one you require.  A tick will appear next to it when it's been selected.  Now press the button labelled General at the top of the screen to return to the General settings.


Do not allow Wireless radio to go to sleep.
Settings -> Wireless and network -> Wi-Fi settings -> (Menu) Advanced -> Wi-Fi sleep policy -> Never.