Trying to scan for devices

i am trying to make a remote using VB6 and so fa so good.
I wanted to know if there is an easy way to get all kodi devices
that are switched on.
At present i manually enter in details to connect to a device.
What i would like to do is scan for devices, pick one then
get the IP,Mac,Port etc that is required.

please, if anyone can help

tks

Garry