Why can't my laptop stay connected to WiFi when locked? My laptop isn't staying connected to it's wireless connection when I lock it. I set up an alias using this post and tried to follow the instructions from this one, and those didn't work for me either. My prefs for en0 (the wireless interface) are as follows:

AirPort preferences for en0:

DisconnectOnLogout=NO
Unable to retrieve JoinMode
JoinModeFallback=DoNothing
RememberRecentNetworks=YES
RequireAdminIBSS=NO
RequireAdminNetworkChange=NO
RequireAdminPowerToggle=NO
WoWEnabled=YES


And the alias I use to lock the screen is:

alias lockscreen='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'


My system info is below as well:



Any recommendations or any ideas of what I'm doing wrong? I don't believe this is a duplicate of the other question since the answers in there didn't work for me, so any advice would be appreciated.

Edit: Going to my username and clicking Login Window... to lock the screen also disconnects the WiFi.
All right, so I've figured out a way to do it. I tried using the command pmset displaysleepnow, and it works as intended. The additional thing is that you have to go to System Preferences > Security &amp; Privacy > General and require a password immediately after the computer display goes to sleep. I then set up an alias:

alias lscreen='pmset displaysleepnow'


and it works as intended. I use the terminal a lot, so lscreen is an easy way for me to lock my screen and come back with my screen being locked but both my WiFi and VPN still connected.