Connection based on device name.

Hello,

This is Jahnavi. I am having nrf52 DK development kit  and with that development kits I am using light switch example to connect the boards as mesh network. How can one device (Client) will get connect with the other one (Server) automatically by verifying the device specifications? Where can we make changes in the code? How to select the nearest device(Client)  to the Server and make connections with it?