Wifi disconnects when you lock OSX screen ? then you should try this.

Consider when you are in middle of downloading something very important & in between you want to lock the screen, But screen lock will disconnect wifi which will stop your important download in progress If you are lucky enough, you can resume that download after re-login but wait what if it is not resumable ? So you have to start over again.

Lets find how we can lock the screen without disconnecting the wifi connection.

We can follow steps
1 . Create 'Screen Saver Service' using Automator 
2 . Bind this service with keyboard shortcut.

Now lets create Screen Saver service using Automator

You can learn some basic about creating simple service in mac Here
Just go to Applications & run , choose "Service" as type for document as shown in snap below.

It will create empty workflow for your service. Then select "no input " as option for Service receives...checkbox.

Keep next checkbox option as "any application", Search Screen saver... in search box as shown below. It will filter "Start Screen Saver" Action for you, then add that action in your workflow by dragging it to right side panel.

After adding this action your workflow should look similar to below snap. You can test this workflow by hitting Run button at right upper corner.

Finally save this service with any name as you want. I saved it with name "screen_saver_service".

Then open System Preferences & & goto Keyboard shortcut by following path as
System Preferences->Keyboard->Shortcut Tab->Services option ,
refer below snap

Here you will see  service "screen_saver_service" already listed in General section, you just need to set key combinations to invoke this service as per your liking. Now you are good to go for locking your screen by pressing keys you just set.