EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.82k stars 419 forks source link

The client can't find the the server by using "discoverHost" in Android #89

Open daojudada opened 9 years ago

daojudada commented 9 years ago
Excuse me, I hava a problem for your kryonet.
In my Application,a phone can't find the server which be create by other phone,when the two phone connect to the same WiFi.so i check your code,Then i find the client only send the broadcast package with the ip adddress "255.255.255.0" and "255.255.0.0".
so,why do the client broadcast with the "255.255.255.255",i change your code to that:

InetAddress targetAddr = InetAddress.getByName("255.255.255.255"); try { socket.send(new DatagramPacket(data, data.length, targetAddr, udpPort)); } catch (Exception ignored) { }

Then the client can find the server.So my problem is why won't do that?
sorry for my poor english :-)
adnanhz commented 8 years ago

Hey, I'm having the same problem. I found this old community fix which seems to have solved the problem (I haven't tried it personally yet). I wonder if it was ever implemented ? https://groups.google.com/forum/#!topic/kryonet-users/UO8B9jzV5Bo