WiFi goes to PSM or CAM not under the control of the application, this is 802.11 power management mode - whenever there is traffic, WiFi goes to CAM, when the transfer is completed, it returns to PSM. At the application level, you just generate some traffic, the NIC driver will automatically go into the correct mode.
source
share