swiftlighthe / kryonet

Automatically exported from code.google.com/p/kryonet
0 stars 0 forks source link

Discovery broken out of the box #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download the latest .zip
2. Using the all jar.
3. Just run the discovery code copy pasted from the front page of this project. 
First run server, then run client. The client immediately throws an exception.

What is the expected output? What do you see instead?
This code should work out of the Box

What version of the product are you using? On what operating system?
Kronet 2.20
Mac OSx 10.8

Please provide any additional information below.
Immediately get this error on the client.

00:00 ERROR: [kryonet] Host discovery failed.
java.io.IOException: Invalid argument
    at java.net.PlainDatagramSocketImpl.send(Native Method)
    at java.net.DatagramSocket.send(DatagramSocket.java:625)
    at com.esotericsoftware.kryonet.Client.broadcast(Client.java:412)
    at com.esotericsoftware.kryonet.Client.discoverHost(Client.java:428)
    at DiscoveryClient.main(DiscoveryClient.java:15)
null

Original issue reported on code.google.com by golgo...@gmail.com on 29 Dec 2012 at 10:19

GoogleCodeExporter commented 9 years ago
Ah, fixed it. You need to require ipv4 like this.
System.setProperty("java.net.preferIPv4Stack" , "true");

Original comment by golgo...@gmail.com on 29 Dec 2012 at 10:24

GoogleCodeExporter commented 9 years ago
This actually fails as a client in Android though, with or without that 
property. The stack trace is as follows.

12-29 18:07:57.619: I/System.out(8041): 00:00 ERROR: [kryonet] Host discovery 
failed.
12-29 18:07:57.619: I/System.out(8041): java.net.SocketException: sendto 
failed: ENETUNREACH (Network is unreachable)
12-29 18:07:57.619: I/System.out(8041):     at 
libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506)
12-29 18:07:57.619: I/System.out(8041):     at 
libcore.io.IoBridge.sendto(IoBridge.java:475)
12-29 18:07:57.619: I/System.out(8041):     at 
java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:182)
12-29 18:07:57.619: I/System.out(8041):     at 
java.net.DatagramSocket.send(DatagramSocket.java:284)
12-29 18:07:57.619: I/System.out(8041):     at 
com.esotericsoftware.kryonet.Client.broadcast(Client.java:412)
12-29 18:07:57.619: I/System.out(8041):     at 
com.esotericsoftware.kryonet.Client.discoverHost(Client.java:428)
12-29 18:07:57.619: I/System.out(8041):     at 
jibo.networking.MainActivity$1.run(MainActivity.java:60)

Original comment by golgo...@gmail.com on 29 Dec 2012 at 11:21

GoogleCodeExporter commented 9 years ago
I can confirm that this is broken on both Desktop and Android. Setting 
System.setProperty("java.net.preferIPv4Stack" , "true");
didn't help on either system.
Would be awesome if you can fix this! :)

Original comment by maximili...@gmail.com on 26 Feb 2013 at 10:20

GoogleCodeExporter commented 9 years ago
Not sure what the deal is with this. Android networking is notoriously bad...

Original comment by nathan.s...@gmail.com on 26 Feb 2013 at 10:41

GoogleCodeExporter commented 9 years ago
I have the same issue. 

here "doomtoo on: 22-09-12" claims to have an fix to the problem: 
https://groups.google.com/forum/?fromgroups=#!topic/kryonet-users/UO8B9jzV5Bo

I think he is right about the issue but I'm quite a noob with .jars and can't 
get his fix working (I get a whole bunch of other errors due to lib related 
stuff) 

maybe one of you guys can get his fix working?

Original comment by JedyDe...@gmail.com on 26 Feb 2013 at 11:04

GoogleCodeExporter commented 9 years ago
My project works now again look at this conversation: 

doomtoo, on 22-09-12:
https://groups.google.com/forum/?fromgroups=#!topic/kryonet-users/UO8B9jzV5Bo

Original comment by JedyDe...@gmail.com on 27 Feb 2013 at 11:16

GoogleCodeExporter commented 9 years ago
same problem, same solution (on KindleFire HD and on other Android devices)

Original comment by naar...@gmail.com on 14 Sep 2013 at 8:55