Is Wifi enabled in iOS 5 even when the device is put to sleep?

Solution 1:

iOS 4

If the phone is connected to a power source, then Wifi remains enabled, even if the phone goes to sleep. If the phone is not connected to a power source, then Wifi is disabled once the phone goes to sleep.

This of course was by design in an effort to reduce battery consumption.

iOS 5

iOS 5 looks to have altered the behaviour of the device. If iTunes wireless syncing is enabled and iTunes is running, the device will listen to any Wifi connection and wake for it (even SSH, which requires a jailbreak to install). I've tested the device with iTunes not running and it indeed behaves as it did in the previous iteration of iOS, refusing to allow a connection through SSH until I woke the device.

However, it seems this is not consistent. Leaving the phone unconnected and iTunes running, I started an SSH session and began transferring some files. When the phone went to sleep, the connection was lost. So it looks like the answer is "yes, but don't count on it?" Clearly iTunes wireless syncing throws us a curveball here.

Solution 2:

I think you'll find that the 4S is awake on WiFi for 10 seconds in every 4 minutes (240 seconds) irrespective of the iTunes Sync setting.

This can be tested by opening a DOS prompt on a Windows machine (or in Terminal on OS X) connected to the same network as your iPhone WiFi.

Find out the IP address allocated to your phone (on phone > Settings > Wi-Fi > {network name} > IP Address

Type the following command (example):

ping 192.168.1.123 -t 

(where the number is the IP address of the phone and -t means keep pinging; on OS X, omit the -t as it isn't needed)

Wait and you'll see a burst of responses for 10 seconds every 230 seconds (230 + 10 = 240 = 4 minutes)