Refined discovery

TODO: implement UDP reading and replying