To come back and solve this, I am responding now because I had a similar problem in another language and in another project and reminded this problem here: I solved it using a webserver, which holds the SSID of the network, if the network is over LAN, the public IP is used. With their SSID/IP the servers register at that server and give their local IP, too, and the clients ask the webserver for a list with the given SSID/IP and the webserver gives them all servers that registered under that SSID/IP.
Only thing I worried about, but is at least in my case very unlikely, that two SSIDs of networks match.