Page 1 of 1

UDP on Unity

Posted: 20 Nov 2018, 09:10
by JohnHacker
Hi! sfs.UdpAvailable is returning false on Unity. Also if I still force sfs.InitUDP() it isn't connecting. I'm doing it on the OnLogic callback according http://docs2x.smartfoxserver.com/Advanc ... p-protocol but it still doesn't work. I couldn't find any information on similar problems and I wonder if UDP support has been deprecated because I understand it should only be disabled under WSS.

Thanks!

Re: UDP on Unity

Posted: 20 Nov 2018, 17:03
by Lapo
Hi,
what version of the API you're using?

Keep in mind that if your export target is WebGL, UDP will not be available. Other than that it should always work.
However you must make sure that UDP is active on the server side.

1-> By default SFS2X can receive UDP messages only on the localhost (127.0.0.1). If you're testing on separate client/server machines you must open the AdminTool > Server Settings and change the UDP listener from 127.0.0.1 to 0.0.0.0

2-> UDP might be blocked by firewalls. If you run one on your server machine make sure that it allows UDP traffic on the port you've configured on the SFS2X side (default = 9933)

Hope it helps

Re: UDP on Unity

Posted: 22 Nov 2018, 09:06
by JohnHacker
Hi! The server is 2.13.1 and the API I had the 1.7.4 or 1.7.5. I've just tested with the last one, 1.7.10 and sfs.UdpAvailable keeps returning false. The WebSocket library is not even compiling so it shouldn't return false due to that. Unity version is 2018.2.0f2.

Thanks!

Re: UDP on Unity

Posted: 22 Nov 2018, 09:39
by Bax
Hi.
I confirm we have an issue with that UdpAvailable flag, which always returns false. We will fix this in a future API update.

Anyway, this doesn't prevent the UDP connection to be established when you call the InitUDP method after a successful login.
Are you sure this doesn't work? Do you add the OnUdpInit handler and check the "success" parameter when the event is fired?

If everything is ok on the client side and you still can't initialize UDP successfully, then there must be an issue on the server side. Did you check the configuration as Lapo suggested before?

Re: UDP on Unity

Posted: 22 Nov 2018, 11:10
by JohnHacker
Hi! It works now. Thanks for the help!