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

discoverHost throws error on iOS #57

Open ocfmem opened 10 years ago

ocfmem commented 10 years ago

Using client.discoverHost on Android and desktop works without issue. But it fails on iOS (using for RoboVM for port). (For information creating a server on iOS works perfectly, you can connect to it with an Android Client and all goes well. )

The stack:

[WARN] java.lang.Class: Class.forName() failed to load 'android.os.Process' Exception in thread "Thread-7" java.lang.IllegalArgumentException: sockaddrToInetAddress bad ss_family: 0 at libcore.io.Posix.recvfromBytes(Native Method) at libcore.io.Posix.recvfrom(Posix.java) at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java) at libcore.io.IoBridge.recvfrom(IoBridge.java) at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java) at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java) at java.net.DatagramSocket.receive(DatagramSocket.java) at com.esotericsoftware.kryonet.Client.discoverHost(Client.java)

Tested with Kryonet 2.20 and 2.21

NathanSweet commented 10 years ago

Very cool to hear it mostly works with RoboVM! I'm afraid you'll probably have to go to RoboVM for help on the crash.

ChetRippo commented 10 years ago

Hi,

I'm getting this same error on kryonet 2.21 and latest libgdx/roboVM releases. Has anyone found a fix?

NathanSweet commented 10 years ago

Don't know about robovm, but discoverHost is of limited use.

-Nate

On Tue, May 20, 2014 at 8:17 PM, Brett Davis notifications@github.comwrote:

Hi,

I'm getting this same error on kryonet 2.21 and latest libgdx/roboVM releases. Has anyone found a fix?

— Reply to this email directly or view it on GitHubhttps://github.com/EsotericSoftware/kryonet/issues/57#issuecomment-43663408 .

ocfmem commented 10 years ago

Nope, I still have no fix for that as well as no workaround for now :/ I could not spend much time on it for now.

The only remaining issue is the discoveryHost.

2014-05-20 20:37 GMT+02:00 Nathan Sweet notifications@github.com:

Don't know about robovm, but discoverHost is of limited use.

-Nate

On Tue, May 20, 2014 at 8:17 PM, Brett Davis notifications@github.comwrote:

Hi,

I'm getting this same error on kryonet 2.21 and latest libgdx/roboVM releases. Has anyone found a fix?

— Reply to this email directly or view it on GitHub< https://github.com/EsotericSoftware/kryonet/issues/57#issuecomment-43663408>

.

— Reply to this email directly or view it on GitHubhttps://github.com/EsotericSoftware/kryonet/issues/57#issuecomment-43666037 .

ChetRippo commented 10 years ago

@NathanSweet I'm not sure I understand what you mean-Should I not be using DiscoverHosts? If not, do you have any recommendations for how to get similar functionality? The game I am developing needs to automatically connect players to each other.

NathanSweet commented 10 years ago

It only works on a LAN and even then depends on the network hardware and configuration. You should probably have a server for match making.

-Nate

On Wed, May 21, 2014 at 4:28 PM, Brett Davis notifications@github.comwrote:

@NathanSweet https://github.com/NathanSweet I'm not sure I understand what you mean-Should I not be using DiscoverHosts? If not, do you have any recommendations for how to get similar functionality? The game I am developing needs to automatically connect players to each other.

— Reply to this email directly or view it on GitHubhttps://github.com/EsotericSoftware/kryonet/issues/57#issuecomment-43761215 .

ChetRippo commented 10 years ago

Ah right, it's a LAN game though, not online.

ntherning commented 10 years ago

This is a bug in RoboVM caused by weird behavior in OSX/iOS when receiving empty UDP packets. We have pushed a workaround which seems to fix the problem. In any case you should close this as it's been confirmed to be RoboVM-related. See robovm/robovm#344.